Desktop multi-plataform ruby app

Victor R. wrote:

Can JRuby coexist with C-Ruby?

Yes, and you can have any number of entirely separate JRuby installs or
a single one you use. It’s up to you. The JRuby install process is
essentially “1. unpack, 2. run” provided you have a compliant JVM
installed (almost all OSes have free and Free compliant JVMs available
now).

Does anyone have any performance numbers of Ruby vs JRuby?

Should be as good, but let us know if not.

Would any JRuby appl with GUI run on any *NIX server that supports Java?

Java is Java wherever you go, so the same GUI will basically work as-is
on any *NIX. For a non-GUI example, we have people running Rails + weird
database access on systems like AS/400 and HP/UX.

Is there a drag and drop widgets creation GUI design under JRuby with Swing?

Matisse does the drag-and-drop and MonkeyBars makes it all Ruby-nice.

Currently I am running Ruby 1.8.7 and on some servers I am playing 1.9. What
is the equivalent version of JRuby to the latest level of Ruby?

Almost nobody is asking for 1.9 features, so we’ve only taken a marginal
interest. If people want those features, it wouldn’t take more than a
couple dedicated weeks to get them in.

How far behind is JRuby from Ruby (C-Ruby)?

Not far behind at all…most normal pure-Ruby code should “just work”.
The places we find bugs these days are in our Java integration layer (up
for a rewrite this summer) or where you interact with system-level
resources (IO and process control are especially twitchy). But if you’re
not doing anything that wouldn’t have portability challenges under
normal Ruby, it will probably work great in JRuby too.

  • Charlie

Dear Monkeybars developers,

how did you produce the videos ?

Thanks.

Best regards,

Axel

On Sun, Jun 8, 2008 at 12:03 AM, Leslie V.
[email protected] wrote:

Compiling 1 source file to /home/lesliev/dev/ruby-gui/demo/build/classes
Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(0));
/home/lesliev/dev/ruby-gui/demo/src/org/rubyforge/rawr/Main.java:19:
cannot find symbol
symbol : variable JavaEmbedUtils
location: class org.rubyforge.rawr.Main
Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(0));
4 errors
BUILD FAILED (total time: 2 seconds)

I’d seriously like to know how to continue here. Either I missed a
tutorial page
somewhere or the tutorials stop short of actually building a form and
connecting
it to the Ruby program. Did I miss something?

Les

On Jun 8, 9:44 am, Charles Oliver N. [email protected]
wrote:

Victor R. wrote:

Can JRuby coexist with C-Ruby?
y-nice.

Currently I am running Ruby 1.8.7 and on some servers I am playing 1.9. What
is the equivalent version of JRuby to the latest level of Ruby?

Almost nobody is asking for 1.9 features, so we’ve only taken a marginal
interest. If people want those features, it wouldn’t take more than a
couple dedicated weeks to get them in.

It seems that Ruby-1.8.7 has many features from ruby-1.9.
I think it’s important to support these as soon as possible.
It seems obvious that this is going to come without asking for it.
As you, at sun staff are going a great job around jruby: no need
to ask for obvious feature… we know that it will be done some day
(no emergency).

But, about GUI tool kit, one thing that would be realy (realy) great
is to port the standard Tk tool kit to java. this would make it
possible
to migrate native Ruby/Tk application to Jruby.

The big part of this work seems to already be done by Bruce Johnson
with it’s swank package (port of tk to java for use with jacl (port
of TCL language to java)

About other Gui toolkit, it seems that there is some confusion
between
true Gui user interface with complex event handling abilities
(key, mouse, …) and power canvas drawing features with event binding
(like Tk and other) and just html forms like toolkit with some
graphic
capabilities.

I think it’s easiest to switch a programm from one (stuctures or oo)
language to another language, than to move from one Gui system to
another
one in the same language.
So the choice of a Gui toolkit is important!

About startup jruby time:

mdiam wrote:

…jruby is still a litle slower than ruby at startup time, because
of the JVM)

In 1.1.2 we have hopefully improved that…for me, startup time went
from 1.5s to about .6s, which is a great improvement. Others have
reported similar boost, maybe not as great. Work continues.

Yes I confirm the great startup improvemnt of the last jruby version,
but I had
to find some inconvenient of jruby ower ruby (but the big one is
about
native library bindings like Tk!)

– Maurice


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Sat, 2008-06-07 at 05:57 +0900, James B. wrote:

If you have questions, jump on #monkeybars on irc; the Monkeybars squad
is usually about and very happy to answer questions.

Which network? Freenode? The #monkeybars channel there has no topic
and one person idling in it. :slight_smile:

Great man!
I will really try it.

To be fair with monkeybars, i think it’s the easier way to have a mvc +
gui
“drag and drop” designer.

Thanks everyone for help. :slight_smile:

On Sun, Jun 8, 2008 at 4:35 AM, Charles Oliver N. <

On Sun, Jun 8, 2008 at 8:20 AM, Michael T. Richter
[email protected]
wrote:

[email protected])
Never, ever, ever let systems-level engineers do human interaction design
unless they have displayed a proven secondary talent in that area. Their
opinion of what represents good human-computer interaction tends to be a bit
off-track. (Bruce Tognazzini)

Team,

Tristin: I already tried the suggestion of FxRuby plus other GUIs. The
documentation for FxRuby was so so. I am the type that learn by example.
Hassan: I’ll give it a try without un-installing “regular” Ruby.
Tom: I am also terrified of the Java T-Rex. So many packages, so many
ways
to configure it, so many …
I went to

found the soft requirements. I proceeded to Sun site and downloaded a
ton of software: JDK, JRE, NetBeans, Etc. My installation went fine.
The
problem is when I try something as simple as jruby -v (I do ruby -v for
regular ruby, so I assume the same is valid for jruby only with the
prefix
j). I got the msg:

   Set JAV_HOME to point to your JDK/JRE directory.

I am using MS Windows XP and I set the variable. So now it works as long
as
I am inside the C:\jruby-1.1.2\bin dir. I tried setting the PATH but
nothing.
*C:\jruby-1.1.2\bin>jruby -v
ruby 1.8.6 (2008-05-28 rev 6586) [x86-jruby1.1.2]

*I set the PATH but nothing. Perhaps I am not setting the PATH
correctly. So
this is my new show-stopper. I will continue playing until I either get
it
or get tired. Although I am already getting tired. This is not supposed
to
be this difficult. But dealing with Java nothing is ever simple.
Leslie: Does Glade provides a drag/drop widget creation feature? I
went to
glade.gnome.org but could not find anything about it.
Charles: That’s a good feature I see useful. “Java is Java and so the
same
GUI will basically work as-is on any *NIX”. One thing that worries me
though, the JRuby site states that JRuby supports “almost” all the Ruby
classes. I have Ruby 1.8.6 running in well over 100 production AIX
Servers.
If I convert to JRuby and need to ensure that current scripts will still
work under it. Is there any docs stating what’s not support in JRuby
which
is in Ruby?

Well, I am about to reboot my desktop and see if that will fix my
problems.
I did not rebooted after the NetBeans installation.

Thanks everyone!

Victor

Victor R. wrote:

Charles: That’s a good feature I see useful. “Java is Java and so the same
GUI will basically work as-is on any *NIX”. One thing that worries me
though, the JRuby site states that JRuby supports “almost” all the Ruby
classes. I have Ruby 1.8.6 running in well over 100 production AIX Servers.
If I convert to JRuby and need to ensure that current scripts will still
work under it. Is there any docs stating what’s not support in JRuby which
is in Ruby?

Continuation support is the only major class intentionally missing. As
far as general features go, the other big one is that we don’t support
C-based extensions, but usually there’s a Java library that does just as
well. Just about everything else should be there. If it’s missing, we
want to add it. If it’s not working correctly, we want to fix it.

  • Charlie

On Sun, Jun 8, 2008 at 4:19 PM, Victor R. [email protected]
wrote:

Tristin: I already tried the suggestion of FxRuby plus other GUIs. The
j). I got the msg:
or get tired. Although I am already getting tired. This is not supposed to
be this difficult. But dealing with Java nothing is ever simple.
Leslie: Does Glade provides a drag/drop widget creation feature? I went to
glade.gnome.org but could not find anything about it.

Glade is a form builder, it allows you to drop containers onto forms
and Gtk widgets
into those containers. This is not the same as with Netbeans or Visual
Studio,
but you can get the same results and in some ways the system is better

  • it takes better care of how forms change when text is translated or
    fonts changed.

You may find it has a learning curve in the beginning, but only until
you understand
how things work, after that it’s quick and easy.

I’m putting together a 5-minute tutorial but I’ll include the text
portion below
to get you started. The tutorial uses the “glader” script which I’ll
include at the bottom.

Warning: I haven’t tried glader in Windows yet!

Starting out with Glade and Ruby

Open glade.

  1. Add a new window, common → border width: 10
  2. Add a vbox to the window (2 items), general → spacing: 10
  3. Add a hbox to the bottom area, general → spacing: 10
  4. Right-click hbox in tree, add parent, alignment
  5. Put a button in each of the two bottom blocks
  6. On the alignment container, horizonal scale: 0, vertical scale: 0,
    horizontal alignment: 1
  7. On the alignment container, expand: no, fill: no

If expand is no, the area does not take on more space when the parent
grows.
If expand is yes, the area will grow with its parent, and ‘fill’
controls how it grows.
If ‘fill’ is yes, extra space is added around the widgets, otherwise
the extra space
goes inside the widget and the widget itself grows.

  1. Add a table in the top space
  2. table, packing → expand: no, general → row spacing: 10, column
    spacing: 10

Before saving, click on window1, signals → gtkobject → destroy and
select
“on_window1_destroy” from the combo.

Now save as “designation” and run “./glader designation.glade” from
the command line.
After generation, run “ruby designation.rb”

Note that when you resize, everything still looks good except the
three labels, which
shouldn’t grow horizontally like that.
Also, since you added the on_window1_destroy signal, you can close the
window and your
Ruby program will exit nicely (glader wrote a handler for that).

Return to Glade.

  1. label1, packing → fill: deselect expand
  2. Do the same for the other two labels
  3. Save

Now re-run designation.rb. You don’t have to regenerate since the class
and main
file will not change, only the form definition (glade) file. If you
resize you’ll
see that the labels now stay small and only the text fields and combo
boxes grow,
which is nice.

----------------------- glader.rb
#!/usr/bin/ruby -w

This class is a quick way of creating a runnable Ruby program from

a single Glade form.

class Glader
def initialize(glade_filename)
raise ArgumentError.new(“File missing: #{glade_filename}”) if
!File.exist?(glade_filename)
raise ArgumentError.new(“Not a .glade file: #{glade_filename}”) if
glade_filename !~ /.*.glade/

@glade_filename = glade_filename
@base_filename = File.basename(@glade_filename, ".glade")
@class_filename = @base_filename + "_glade.rb"

end

Runs the ruby-glade-create-template script to create a file with a

class that corresponds to the form. This can be called repeatedly

to keep creating the class every time the .glade file changes.

def make_class
/usr/bin/ruby-glade-create-template #{@glade_filename} > #{@class_filename}
@class_filename
end

Creates a main program that uses the glade class created with

make_class and opens the window with the form. It will do nothing

if the main program file already exists, since the user is likely

to add code to this file.

def make_main
main_filename = @base_filename + ‘.rb’

if(File.exist?(main_filename))
  raise ArgumentError.new("#{main_filename} already exists, 

skipping")
else
File.open(main_filename, “w”) {|f| f.write generate_main}
end
main_filename
end

private
def generate_main()
class_name = File.read(@class_filename).scan(/class (.)/).to_s
window_id = File.read(@glade_filename).scan(/class=“\w+”
id="(\w
)">$/).flatten[0]

main =<<END

require ‘#{@base_filename}_glade’

class #{class_name}
def form
@glade[“#{window_id}”]
end

def show
form.show
end

#if this signal exists, exit nicely

def on_#{window_id}_destroy(widget)
Gtk.main_quit
end
end

form = #{class_name}.new(“#{@glade_filename}”, nil, “Application”)
form.show

Gtk.main

END
end
end

if FILE == $0
if ARGV.length != 1
puts
puts “This script creates a class and a main program that shows a
window using”
puts “that class from a .glade file. It can be used to quickly
generate a functional Ruby”
puts “program from a .glade file”
puts
puts “Usage: #{FILE} <file.glade>”
puts
exit
end

glader = Glader.new(ARGV[0])
print “Making class file (#{glader.make_class})…\n”

begin
print “Making main file (#{glader.make_main})…\n”
rescue => e
puts e.message
end
puts

end

mdiam wrote:

It seems that Ruby-1.8.7 has many features from ruby-1.9.
I think it’s important to support these as soon as possible.
It seems obvious that this is going to come without asking for it.
As you, at sun staff are going a great job around jruby: no need
to ask for obvious feature… we know that it will be done some day
(no emergency).

Are people upgrading to 1.8.7? We started adding those features, but
there seemed a lot of confusion about whether 1.8.7 was going to be
popular or whether people would move to it quickly. But we’ll get those
features into 1.1.3 or 1.1.4 if people really want/need them.

  • Swank
    If Tk whould be port to java, then Tk would be easier to install for
    jruby
    than for ruby!)

I’d love to see someone try to wire this into JRuby, but to date almost
nobody has wanted to use Tk after trying JRuby with Swing. If you
thought it might be interesting to you, there’s some suggestions below
on how to get started.

I think it’s easiest to switch a programm from one (stuctures or oo)
language to another language, than to move from one Gui system to
another
one in the same language.
So the choice of a Gui toolkit is important!

I agree wholeheartedly. And selecting a GUI framework is a decision you
don’t want to have to make multiple times. I certainly consider Swing to
be powerful…sometimes over-powerful. But I can’t imagine what you’d be
able to do in another toolkit you can’t do in Swing. Plus tools like
Monkeybars and Matisse make it really easy.

Beyond that…Tk UIs are a lot harder to make pretty than Swing UIs.
Check out some of the great Swing skinning sites:

https://substance.dev.java.net/ (beautiful UIs)
http://napkinlaf.sourceforge.net/ (particularly cute)
http://www.pagosoft.com/products/pgslookandfeel/index.html?sid=4b6ebdac204dd4dfc00b45de4bc3fd3b
http://www.jgoodies.com/
https://liquidlnf.dev.java.net/

Adn there’s dozens more out there.

Yes I confirm the great startup improvemnt of the last jruby version,
but I had
to find some inconvenient of jruby ower ruby (but the big one is
about
native library bindings like Tk!)

Native library support is probably the most obvious feature missing, but
in my opinion Ruby’s C API is the largest thing holding it back. Yes,
it’s great you can wire in libraries directly to Ruby. But by exposing
all the internal types, structures, functions, and macros used to
manipulate Ruby directly it’s nearly impossible to make the drastic
changes Ruby needs to survive (like a new garbage collector, impossible
because current extensions access memory directly).

There are several options, however:

  • Use a Java library

Tk, for example, is pretty well covered by Swing frameworks for JRuby.
And the number of Java libraries available is legendary. You don’t even
need to use any Java…just load them and call them from Ruby.

  • Port the library to Java

This requires some Java knowledge, but it’s usually far easier than
writing a library in C.

  • Use a foreign function interface

JRuby ships with JNA, which is a Java API for programmatically loading
and calling any C library from Java with only a bit of pre-built JNI
code involved (we ship JNA with support for linux 32/64, solaris
sparc/x86, os x and windows). Using this library directly is one way to
call out to specific C libraries. There’s an example on
jna.dev.java.net.

Another alternative would be to help finish up JRuby’s support for
Rubinius’s FFI API, which is basically an improved DL library, or in
other terms a full Ruby equivalent to JNA. We have a mostly complete
library that we just need to wire in and test. You can inquire on the
JRuby list if you’d like to help.

Personally, I’d love to see people stop using the native Ruby API and
prefer FFI libraries for all extension writing, since those native
extensions are both holding Ruby back and limited to the C impl. And
even though both Rubinius and JRuby have starts on implementing that C
API through various tricks, those tricks will not be able to cover the
entire API and will never perform as well as we would like.

C API == bad. FFI == good.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Axel E. wrote:

Dear Monkeybars developers,

how did you produce the videos ?

David made them on a Mac using some magic Mac software :); hopefully
he’ll pipe up on this thread and give a real answer.

(I use Kubuntu and really can’t tell one mac app from another. )


James B.

www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.risingtidesoftware.com - Wicked Cool Coding

Tom C. wrote:

All the dependencies, etc., DOES look (in the mind) a bit scary, but
I’ve found that if one give the Big Boys a few months, they generally
get things wired together so they Just Work. And beyond that, there’s
the marvelous Ruby community. Rare has been the time that I haven’t
gotten an answer back to whatever problem I’ve posted about - in under
an hour. Phenomenal, actually. The rest of life should be so good!

There are usually a few people on IRC, on #monkeybars, hanging out
willing to answer questions. (Maybe not so much on Sunday; but usually
we’re on the channel.)

There’s also a monkeybars mailing (see www.monkeybars.org)


James B.

www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.risingtidesoftware.com - Wicked Cool Coding

Leslie V. wrote:

I’d seriously like to know how to continue here. Either I missed a tutorial page
somewhere or the tutorials stop short of actually building a form and connecting
it to the Ruby program. Did I miss something?

Possibly. The monkeybars site has a screencast walking though the
coding of an app, including creating a form and wiring it up.

If you have more problems, please contact me directly, or post questions
to the monkeybars list.


James B.

www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.jamesbritt.com - Playing with Better Toys

Michael T. Richter wrote:

On Sat, 2008-06-07 at 05:57 +0900, James B. wrote:

If you have questions, jump on #monkeybars on irc; the Monkeybars squad
is usually about and very happy to answer questions.

Which network? Freenode? The #monkeybars channel there has no topic
and one person idling in it. :slight_smile:

Well, it’s Sunday, and I just got back home. I confess that IRC support
on the weekends is less than ideal.

Folks can E-mail me if they can’t get help on irc.


James B.

www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.jamesbritt.com - Playing with Better Toys

Ok, here’s my Glade tutorial video:
http://www.mediafire.com/download.php?nguxzzmhci8

Here’s the text for the tutorial:
http://www.mediafire.com/download.php?d0cgjyjmtas

Here’s glader as a gem:
http://www.mediafire.com/download.php?d3v3x9vpw9e

For Glade installation tips search this forum for my earlier posts.

Les

Tom C. wrote:

Well, it’s Sunday, and I just got back home. I confess that IRC
support on the weekends is less than ideal.

Folks can E-mail me if they can’t get help on irc.

James, you’re an amazing fellow!

Thank you.

Truth is, I hang with amazing people and some of it rubs off.

:slight_smile:


James B.

“Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety.”

  • Benjamin Franklin, when asked about static typing
    (and a tip of the hat to raganwald)

James B. wrote:

Well, it’s Sunday, and I just got back home. I confess that IRC
support on the weekends is less than ideal.

Folks can E-mail me if they can’t get help on irc.

James, you’re an amazing fellow!

t.

Tom C., MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website & psychotherapy weblog)
<< sleightmind.wordpress.com >> (mental health issues weblog)
<< directpathdesign.com >> (web site design & consultation)

On Jun 6, 8:50 pm, Israel G. [email protected] wrote:

I would prefer something that has a graphical app that can help me creating
the visual part.

Thanks and best regards.


Guerra

QT, Ruby and Rubyscript2exe is a great combination. There is qt
designer for building the gui. The widgets look good on windows. All
that is required to get started on windows:

*)download the one click installer
*)download and install the qtruby gem

The only disadvantage that i can see:

*)is the licensing if you are not developing open source software.
*)once the script is packaged (so that you can use it on other PCs)
using rubyscript2exe there is a few seconds delay before the app is
loaded.

Mark

On Jun 8, 2008, at 2:56 AM, Axel E. wrote:

Dear Monkeybars developers,

how did you produce the videos ?

Thanks.

Best regards,

Axel

They were made using Snapz Pro X for recording and Quicktime Pro for
splicing/cropping.

David K.

On Jun 8, 2008, at 3:22 AM, Leslie V. wrote:

init:
/home/lesliev/dev/ruby-gui/demo/src/org/rubyforge/rawr/Main.java:19:
BUILD FAILED (total time: 2 seconds)

I’d seriously like to know how to continue here. Either I missed a
tutorial page
somewhere or the tutorials stop short of actually building a form
and connecting
it to the Ruby program. Did I miss something?

Les

There are a few example projects on the site:
http://monkeybars.rubyforge.org/examples.html
These are also part of the source repository in the examples
directory:
http://gitorious.org/projects/monkeybars/repos/mainline/trees/master/examples

As for the tutorial pages just leaving off, this is my fault. I got
the pages for installing Netbeans and configuring your environment but
didn’t get back to getting into the usage of Monkeybars. I will be
working on that today and will send out an announcement to our mailing
list when it is uploaded. There is a form to join the mailing list
here: http://monkeybars.rubyforge.org/docs.html

Thank you for your patience.

David K.