Forum: Ruby Native gem roundup!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-02 16:15
(Received via mailing list)
I'm curious what native gems/extensions people are typically using. In
general it seems like most native extensions fall into two categories:

* They are wrappers around a C API/library, as in zlib, rmagick,
nokogiri
* They are written for performance reasons, to implement a particular
algorithm in a native language or call a library for the same reasons

And there's a lot of grey area, with some extensions falling in both
categories.

Wrappers can now largely be handled by FFI, and I hope more and more of
them will use FFI as needed to access those libraries. But I'm concerned
about extensions written for performance, since Ruby 1.9 and JRuby do
almost as much to speed Ruby up.

Ultimately, my quest is to eliminate Ruby's dependence on extensions for
things FFI or "faster Ruby" could do, since it will improve the future
for both the standard and alternative implementations.

So, what native gems or extensions do you use? Why do you use them or
why do they exist?

- Charlie
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-02-02 16:43
> So, what native gems or extensions do you use? Why do you use them or
> why do they exist?

I use mysql, mysqlplus, eventmachine, ruby debug, hitimes, win32-api,
ruby prof,  mongrel, and ferret.  Most wrappers to C libs [which is for
speed].
Cheers!
-=r
8c0b7725a68e5cf9a0548065db0e139b?d=identicon&s=25 Coey Minear (cminear)
on 2009-02-02 16:46
(Received via mailing list)
Charles Oliver Nutter writes:
 > I'm curious what native gems/extensions people are typically using.
In
 > general it seems like most native extensions fall into two
categories:
 >
 > * They are wrappers around a C API/library, as in zlib, rmagick,
nokogiri
 > * They are written for performance reasons, to implement a particular
 > algorithm in a native language or call a library for the same reasons
 >
 > And there's a lot of grey area, with some extensions falling in both
 > categories.
 >
 > Wrappers can now largely be handled by FFI, and I hope more and more
of
 > them will use FFI as needed to access those libraries. But I'm
concerned
 > about extensions written for performance, since Ruby 1.9 and JRuby do
 > almost as much to speed Ruby up.
 >
 > Ultimately, my quest is to eliminate Ruby's dependence on extensions
for
 > things FFI or "faster Ruby" could do, since it will improve the
future
 > for both the standard and alternative implementations.
 >
 > So, what native gems or extensions do you use? Why do you use them or
 > why do they exist?
 >
 > - Charlie
 >

For me, they would be FastCGI and ruby-postgres, two more examples of
wrapping a C library.  (Technically, I currently run FastCGI as
installed --- in 'site_ruby' --- rather than a gem; there was always a
hiccup if I tried to install it as a gem, so I went with the quickest
way to get it working.)

As you may guess, this is a Rails application.  FastCGI is used for
Apache deployment; ruby-postgres is for accessing the PostgreSQL
database.  I know there are other options for Apache/web deployment
(e.g. Mongrel), but this install is stable and other priorities take
precedence over investigating alternative deployment configurations.
For PostgreSQL, even if I moved to ruby-pg, that is still a C library
wrapper.

Anyways, just trying to answer your query.
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2009-02-02 17:39
Charles Oliver Nutter wrote:
> I'm curious what native gems/extensions people are typically using. In
> general it seems like most native extensions fall into two categories:
>
> * They are wrappers around a C API/library, as in zlib, rmagick,
> nokogiri
> * They are written for performance reasons, to implement a particular
> algorithm in a native language or call a library for the same reasons

* They interact directly with the Ruby interpreter (e.g. rcov,
ruby-debug)

Here's the set on my home machine:

$ cd /usr/local/lib/ruby/gems/1.8/gems/; find . -name '*.so'
./json-1.1.3/ext/json/ext/parser/parser.so
./json-1.1.3/ext/json/ext/generator/generator.so
./json-1.1.3/ext/json/ext/parser.so
./json-1.1.3/ext/json/ext/generator.so
./fastthread-1.0.1/ext/fastthread/fastthread.so
./fastthread-1.0.1/lib/fastthread.so
./rcov-0.8.1.2.0/lib/rcovrt.so
./rcov-0.8.1.2.0/ext/rcovrt/rcovrt.so
./linecache-0.43/ext/trace_nums.so
./linecache-0.43/lib/trace_nums.so
./mongrel-1.1.5/ext/http11/http11.so
./mongrel-1.1.5/lib/http11.so
./sqlite3-ruby-1.2.4/ext/sqlite3_api/sqlite3_api.so
./sqlite3-ruby-1.2.4/lib/sqlite3_api.so
./ruby-debug-base-0.10.3/ext/win32/ruby_debug.so
./ruby-debug-base-0.10.3/ext/ruby_debug.so
./ruby-debug-base-0.10.3/lib/ruby_debug.so
./ruby-gpgme-1.0.3/lib/gpgme_n.so
./ruby-gpgme-1.0.3/gpgme_n.so

On another machine I also have termios, rubywmq, ruby-postgres,
sys-filesystem, RedCloth
F778607e066c8372ab94b0920ed7b2b8?d=identicon&s=25 Jakub Pavlík jn. (Guest)
on 2009-02-02 18:03
(Received via mailing list)
> Wrappers can now largely be handled by FFI, and I hope more and more of
>
> - Charlie

I use RUDL or Rubygame (SDL wrappers) to make games;
ruby-prof for profiling of these games, because pure Ruby profiler from
the standard library slows programs too much down.

Jakub

--
"Configure complete, now type 'make' and PRAY."

                (configure script of zsnes - www.zsnes.com)
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2009-02-02 21:04
(Received via mailing list)
On Feb 2, 2009, at 07:15 , Charles Oliver Nutter wrote:

> * They are wrappers around a C API/library, as in zlib, rmagick,
> nokogiri
> * They are written for performance reasons, to implement a
> particular algorithm in a native language or call a library for the
> same reasons

or they're written to get into ruby internals... I don't quite
consider that a wrapper around C API and it looks like you don't either.
D15a45a973443d4562051eb675b60474?d=identicon&s=25 Tom Cloyd (Guest)
on 2009-02-02 22:24
(Received via mailing list)
Charles Oliver Nutter wrote:
> Wrappers can now largely be handled by FFI, and I hope more and more
>
> - Charlie
>
>
Charlie,

As someone with a social survey research background, I want to advise
you that this is an extremely poor way to get your question answered. If
you're not serious about getting a good answer, your request is very
close to list-noise. If you are, then you need a decent sample OR all
the parametric data (i.e., don't sample it - get it all).

I wonder why you don't go after the latter? Is there someway to get
download counts for various gems? I realize there are hundreds, but THAT
would be useful data.

Alternatively, you could use the gems themselves as your population.
Draw a sample of them, as samples of serious Ruby code (and get at least
35, and preferably much more than that), then scrape from them the gems
THEY use, and get a frequency distribution from that sample.

In terms of bang for buck, I'd go with the latter alternative, 'cause
THAT data would actually be something from which you might reasonably
infer something.

What you're doing with this list-post nonsense is akin to putting a box
of surveys on the sidewalk, with a sign "please fill one out", then
taking your results and thinking they actually MEAN something. Believe
me, they do not.

Hope this helps the "cause".

t.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6e366eb5a71be2bad7f383d42aeb4788?d=identicon&s=25 Justin Collins (Guest)
on 2009-02-02 23:36
(Received via mailing list)
Tom Cloyd wrote:
>> And there's a lot of grey area, with some extensions falling in both
>>
> If you're not serious about getting a good answer, your request is
> the gems THEY use, and get a frequency distribution from that sample.
> Hope this helps the "cause".
>
> t.
>


There is always this:

http://gems.rubyforge.org/stats.html

-Justin
0107ef1bc42d0626a706ca6af9a43060?d=identicon&s=25 Jos Backus (Guest)
on 2009-02-03 03:48
(Received via mailing list)
strongtyping, used by html-table. I sent the author a patch that makes
it work
with 1.8.6 and 1.9.1 but haven't heard back.
D15a45a973443d4562051eb675b60474?d=identicon&s=25 Tom Cloyd (Guest)
on 2009-02-03 09:54
(Received via mailing list)
Justin Collins wrote:
>>> same reasons
>>> for things FFI or "faster Ruby" could do, since it will improve the
>> As someone with a social survey research background, I want to advise
>> Draw a sample of them, as samples of serious Ruby code (and get at
>> Believe me, they do not.
>
> -Justin
>
>
Now, THAT's outright cheating. Worse yet, you probably Googled to find
this (or could have, if you didn't know about it). What is this world
coming too?

t.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:09
(Received via mailing list)
Tom Cloyd wrote:
> As someone with a social survey research background, I want to advise
> you that this is an extremely poor way to get your question answered. If
> you're not serious about getting a good answer, your request is very
> close to list-noise. If you are, then you need a decent sample OR all
> the parametric data (i.e., don't sample it - get it all).

I disagree. I think the people most likely to respond to a mailing-list
request are the exact people I'm looking to reach. Did it occur to you
that perhaps I know there are download stats for all gems that I could
mine? I'm looking to gauge the importance of gems to vocal mailing-list
participants directly, by posting a general message here and seeing who
responds. And I've gotten a lot of great responses, both on-list and
off. If I wanted an accurate count of gem downloads (no doubt inflated
by older gems including dev-time libraries as runtime dependencies) I
certainly could get that. But people coming out and saying "I really
need X" is far more interesting.

So please, others, feel free to reply with what X you find important.

And Tom, thanks for your input. What native extensions do you find
useful?

- Charlie
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:17
(Received via mailing list)
Roger Pack wrote:
>> So, what native gems or extensions do you use? Why do you use them or
>> why do they exist?
>
> I use mysql, mysqlplus, eventmachine, ruby debug, hitimes, win32-api,
> ruby prof,  mongrel, and ferret.  Most wrappers to C libs [which is for
> speed].
> Cheers!

Thanks for the response!

Is that the win32 that ships with MRI or something else? I don't use MRI
much, so I'm not familiar with that library.

eventmachine and mongrel..I assume we're talking about evented mongrel?

ruby_debug and ruby_prof...I see ruby_prof coming up a lot. I think
we'll simply need to provide something similar out of the box for JRuby.
Hmmm.

One last question....why mysql or mysqlplus gems instead of the "nice"
DB wrapper libraries like Sequel, DataMapper, and so on?

- Charlie
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:18
(Received via mailing list)
Coey Minear wrote:
> As you may guess, this is a Rails application.  FastCGI is used for
> Apache deployment; ruby-postgres is for accessing the PostgreSQL
> database.  I know there are other options for Apache/web deployment
> (e.g. Mongrel), but this install is stable and other priorities take
> precedence over investigating alternative deployment configurations.
> For PostgreSQL, even if I moved to ruby-pg, that is still a C library
> wrapper.
>
> Anyways, just trying to answer your query.

Cool, thanks. Are you using ruby-postgres through ActiveRecord itself or
standalone in some way

- Charlie
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:23
(Received via mailing list)
Brian Candler wrote:
>> * They are wrappers around a C API/library, as in zlib, rmagick,
>> nokogiri
>> * They are written for performance reasons, to implement a particular
>> algorithm in a native language or call a library for the same reasons
>
> * They interact directly with the Ruby interpreter (e.g. rcov,
> ruby-debug)

Damn good point...you totally trumped me there. So there's three cases,
with this new one perhaps being truly the most impl-specific case.

> Here's the set on my home machine:
>
> $ cd /usr/local/lib/ruby/gems/1.8/gems/; find . -name '*.so'
> ./json-1.1.3/ext/json/ext/parser/parser.so
> ./json-1.1.3/ext/json/ext/generator/generator.so
> ./json-1.1.3/ext/json/ext/parser.so
> ./json-1.1.3/ext/json/ext/generator.so

Do people generally use the native json gem for performance reasons?
Does a pure-ruby version not cut it? Are there benchmarks?

> ./fastthread-1.0.1/ext/fastthread/fastthread.so
> ./fastthread-1.0.1/lib/fastthread.so

Ok, not needed under JRuby, recent Ruby 1.8.6 or 1.8.7+.

> ./rcov-0.8.1.2.0/lib/rcovrt.so
> ./rcov-0.8.1.2.0/ext/rcovrt/rcovrt.so

Tooling...blasted tooling. JVM has so much good tooling, if I could only
harness it well for Ruby stuff.

> ./ruby-gpgme-1.0.3/gpgme_n.so
>
> On another machine I also have termios, rubywmq, ruby-postgres,
> sys-filesystem, RedCloth

Thanks for the response. Obviously I'm interested because of JRuby, and
I think most of these have equivalents already, but there are obviously
gaps. I think dev-time tooling may actually be where we're weakest at
the moment, which is ironic given the history of JVM/Java-based tooling.

- Charlie
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:24
(Received via mailing list)
Jakub Pavlík jn. wrote:
>> Wrappers can now largely be handled by FFI, and I hope more and more of
>>
>> - Charlie
>
> I use RUDL or Rubygame (SDL wrappers) to make games;
> ruby-prof for profiling of these games, because pure Ruby profiler from the standard 
library slows programs too much down.

I think someone was working on SDL over FFI recently, but I don't
remember who and I don't remember how far they got. I'd love to see it
myself.

ruby-prof...noted. Seems like an essential tool for most folks, we'll
just have to provide something.

- Charlie
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:25
(Received via mailing list)
Ryan Davis wrote:
> or they're written to get into ruby internals... I don't quite consider
> that a wrapper around C API and it looks like you don't either.

Yeah, that's definitely a third category I totally missed. It's an
unusual one, though, since it doesn't necessarily have to be "native"
(it could be in Ruby in Rubinius, or Java in JRuby...)

And my failure to recognize it could be why we don't have a ruby-prof
for JRuby yet. Definitely noted.

- Charlie
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:27
(Received via mailing list)
Jos Backus wrote:
> strongtyping, used by html-table. I sent the author a patch that makes it work
> with 1.8.6 and 1.9.1 but haven't heard back.

I was unaware of strongtyping...very glad you brought it to my
attention. So many projects, so little time...but this warrants some
time.

Thank you!

- Charlie
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2009-02-03 10:29
(Received via mailing list)
On Feb 3, 2009, at 01:24 , Charles Oliver Nutter wrote:

> Ryan Davis wrote:
>> or they're written to get into ruby internals... I don't quite
>> consider that a wrapper around C API and it looks like you don't
>> either.
>
> Yeah, that's definitely a third category I totally missed. It's an
> unusual one, though, since it doesn't necessarily have to be
> "native" (it could be in Ruby in Rubinius, or Java in JRuby...)

Yeah. just depends on the impl's API into itself. ParseTree simply
isn't necessary on rubinius.
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-02-03 10:41
(Received via mailing list)
Ryan Davis wrote:
> Yeah. just depends on the impl's API into itself. ParseTree simply isn't
> necessary on rubinius.

I'm still interested in producing a PT-compatible sexp from JRuby's AST,
but it becomes harder the more we customize that AST (and the more we
pre-compile code and dump the memory-expensive AST).

The other stuff, though, we definitely need. Profiling, debugging
(including into Java code, if necessary), code coverage. It's
"interesting" to be reinventing all these tools again atop the JVM, but
it's also frustrating that they weren't created language-agnostic by JVM
advocates in the beginning.

Myopic idiots.

- Charlie
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2009-02-03 12:24
>> $ cd /usr/local/lib/ruby/gems/1.8/gems/; find . -name '*.so'
>> ./json-1.1.3/ext/json/ext/parser/parser.so
>> ./json-1.1.3/ext/json/ext/generator/generator.so
>> ./json-1.1.3/ext/json/ext/parser.so
>> ./json-1.1.3/ext/json/ext/generator.so
>
> Do people generally use the native json gem for performance reasons?
> Does a pure-ruby version not cut it? Are there benchmarks?

I only use it by default, because there are other gems which have
dependencies on "json" rather than "json_pure". e.g.

$ gem dependency couchrest
Gem couchrest-0.12.4
  json (>= 1.1.2, runtime)
  rest-client (>= 0.5, runtime)
  mime-types (>= 1.15, runtime)

Regards,

Brian.
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2009-02-03 15:33
(Received via mailing list)
On Feb 3, 2009, at 3:22 AM, Charles Oliver Nutter wrote:

> Do people generally use the native json gem for performance reasons?
> Does a pure-ruby version not cut it? Are there benchmarks?

The documentation for the gems says:

# == Speed Comparisons
#
# I have created some benchmark results (see the benchmarks subdir of
the
# package) for the JSON-Parser to estimate the speed up in the C
extension:
#
# JSON::Pure::Parser::  28.90  calls/second
# JSON::Ext::Parser::  505.50 calls/second

The reason I like the extension is that it gets you pretty close to
Marshal's speed:

#!/usr/bin/env ruby -wKU

require "benchmark"
require "yaml"

require "rubygems"
require "json"

TESTS = 10_000
DATA  = {"fields" => [1, 2.0, true, false, nil]}

Benchmark.bmbm do |results|
   results.report("JSON:")    { TESTS.times
{ JSON.parse(DATA.to_json) } }
   results.report("Marshal:") { TESTS.times
{ Marshal.load(Marshal.dump(DATA)) } }
   results.report("YAML:")    { TESTS.times
{ YAML.load(DATA.to_yaml) } }
end
# >> Rehearsal --------------------------------------------
# >> JSON:      0.280000   0.030000   0.310000 (  0.306849)
# >> Marshal:   0.230000   0.040000   0.270000 (  0.267113)
# >> YAML:      5.090000   0.860000   5.950000 (  5.975268)
# >> ----------------------------------- total: 6.530000sec
# >>
# >>                user     system      total        real
# >> JSON:      0.270000   0.030000   0.300000 (  0.294798)
# >> Marshal:   0.230000   0.030000   0.260000 (  0.264460)
# >> YAML:      5.090000   0.870000   5.960000 (  5.965469)

With the pure version though, you are more like halfway between
Marshal and YAML:

#!/usr/bin/env ruby -wKU

require "benchmark"
require "yaml"

require "rubygems"
require "json/pure"

TESTS = 10_000
DATA  = {"fields" => [1, 2.0, true, false, nil]}

Benchmark.bmbm do |results|
   results.report("JSON (pure):") { TESTS.times
{ JSON.parse(DATA.to_json) } }
   results.report("Marshal:")     { TESTS.times
{ Marshal.load(Marshal.dump(DATA)) } }
   results.report("YAML:")        { TESTS.times
{ YAML.load(DATA.to_yaml) } }
end
# >> Rehearsal ------------------------------------------------
# >> JSON (pure):   2.780000   0.620000   3.400000 (  3.409480)
# >> Marshal:       0.230000   0.040000   0.270000 (  0.264554)
# >> YAML:          5.140000   0.880000   6.020000 (  6.040840)
# >> --------------------------------------- total: 9.690000sec
# >>
# >>                    user     system      total        real
# >> JSON (pure):   2.760000   0.630000   3.390000 (  3.407148)
# >> Marshal:       0.230000   0.040000   0.270000 (  0.264310)
# >> YAML:          5.130000   0.870000   6.000000 (  6.004295)

James Edward Gray II
8c0b7725a68e5cf9a0548065db0e139b?d=identicon&s=25 Coey Minear (cminear)
on 2009-02-03 16:22
(Received via mailing list)
Charles Oliver Nutter writes:
 > Coey Minear wrote:
 > > As you may guess, this is a Rails application.  FastCGI is used for
 > > Apache deployment; ruby-postgres is for accessing the PostgreSQL
 > > database.  I know there are other options for Apache/web deployment
 > > (e.g. Mongrel), but this install is stable and other priorities
take
 > > precedence over investigating alternative deployment
configurations.
 > > For PostgreSQL, even if I moved to ruby-pg, that is still a C
library
 > > wrapper.
 > >
 > > Anyways, just trying to answer your query.
 >
 > Cool, thanks. Are you using ruby-postgres through ActiveRecord itself
or
 > standalone in some way
 >
 > - Charlie
 >

Just through ActiveRecord.
90a73d9875462aaa9fab2feffafbffe7?d=identicon&s=25 Ben Bleything (Guest)
on 2009-02-03 18:05
(Received via mailing list)
On Tue, Feb 3, 2009 at 1:17 AM, Charles Oliver Nutter
<charles.nutter@sun.com> wrote:
> Cool, thanks. Are you using ruby-postgres through ActiveRecord itself or
> standalone in some way

I know you weren't asking me, but I'm using both ruby-postgres and the
pg library with AR, Sequel, and standalone.

Ben
D15a45a973443d4562051eb675b60474?d=identicon&s=25 Tom Cloyd (Guest)
on 2009-02-04 07:51
(Received via mailing list)
Charles Oliver Nutter wrote:
> that I could mine? I'm looking to gauge the importance of gems to
> useful?
>
> - Charlie
>
>
Ah, Charlie, most interesting. Your population of interest isn't those
who USE gems but those who talk/yell/gossip/whatever about them. Unusual
notion, I'd say, but hey it's YOUR study, so to speak. I care not.
Thanks for the clarification however. And no, I didn't assume you knew
about about any download stats - I certainly didnt', but I supposed they
might exist.

My favorite gems:

date ruby-debug readline strscan logger fileutils webby

by extension, if you'll excuse my putting it that way, I'd have to
include all their dependencies, too...(e.g, rake, etc.)

Final thought: If you're interested in what people "really need", I
cannot image a better measure of that than what they really USE. And
that is NOT the same universe as what those who respond to your query
happen to talk about. I still think you have a problem - if not a
sampling problem, then a study design problem. Sorry, I'm a bit perverse
about such things. I like to get it right, even with it isn't even my
own question. Some people turn to God in times of trouble. I turn to
statistics. Never could tell the difference, really. (heh heh)

t.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aaca034456897ccbc8bb14953c4a41c1?d=identicon&s=25 Radosław Bułat (radarek)
on 2009-02-04 13:48
(Received via mailing list)
>> Gem::Specification.list.select {|s| s.extensions.size > 0 }.map {|s| s.name }.sort
=> ["RedCloth", "amalgalite", "bcrypt-ruby", "concurrent", "curb",
"do_sqlite3", "ebb", "em_httpserver", "erlectricity", "eventmachine",
"eventmachine_httpserver", "fastthread", "fcgi", "ferret", "ffi",
"fxruby", "god", "hpricot", "json", "linecache", "memcached",
"mongrel", "mysql", "narray", "ncurses", "neuro", "nokogiri",
"oniguruma", "passenger", "raspell", "rbtree", "rcov", "rev", "rice",
"rmagick", "ruby-debug-base", "ruby-opengl", "ruby-postgres",
"ruby-prof", "rubygame", "rubynode", "sqlite3-ruby", "swiftiply",
"termios", "thin", "thin-turbo", "unicode", "zipruby"]

At this moment I have 307 installed gems (I like playing a lot with new
things).

--
Pozdrawiam

Rados³aw Bu³at
http://radarek.jogger.pl - mój blog
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2009-02-04 14:37
(Received via mailing list)
On Feb 4, 2009, at 12:50 AM, Tom Cloyd wrote:

> My favorite gems:
>
> date ruby-debug readline strscan logger fileutils webby

Of those, I believe only ruby-debug and webby are gems.  The rest are
standard libraries that ship with Ruby.  Also, date, logger,
fileutils, and webby are not the native extensions Charlie is looking
for, since they don't involve C code.

James Edward Gray II
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-02-04 16:41
(Received via mailing list)
Rados³aw Bu³at wrote:
>
> At this moment I have 307 installed gems (I like playing a lot with new things).
>

Not sure why this doesn't work for me:

$ ruby -e 'p Gem::Specification.list.select {|s| s.extensions.size > 0
}.map {|s| s.name }.sort'
[]

Still, looking at the output of `find -name '*.so'` on a couple of
systems, and picking out the ones that are really used:

RubyRRDtool
ruby-opengl
json
rbtree
sqlite3-ruby
amalgalite
narray
Aaca034456897ccbc8bb14953c4a41c1?d=identicon&s=25 Radosław Bułat (radarek)
on 2009-02-04 18:10
(Received via mailing list)
2009/2/4 Joel VanderWerf <vjoel@path.berkeley.edu>:
> Not sure why this doesn't work for me:
>
> $ ruby -e 'p Gem::Specification.list.select {|s| s.extensions.size > 0 }.map
> {|s| s.name }.sort'
> []

Don't ask me why but it will work if you load at least one gem by
rubygems. Try with:

ruby -rubygems -e "require 'rake'" -e 'p
Gem::Specification.list.select {|s| s.extensions.size > 0 }.map {|s|
s.name }.sort'

My previous try was from irb session so it was already loaded many gems.
Weird.
Rubygems sucks at many things, specially in loading *all* gems specs
so it end up with eating more memory if you have insalled many gems
(as I do).

--
Pozdrawiam

Rados³aw Bu³at
http://radarek.jogger.pl - mój blog
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-02-04 18:17
(Received via mailing list)
Rados³aw Bu³at wrote:
> ruby -rubygems -e "require 'rake'" -e 'p
> Gem::Specification.list.select {|s| s.extensions.size > 0 }.map {|s|
> s.name }.sort'
>
> My previous try was from irb session so it was already loaded many gems. Weird.
> Rubygems sucks at many things, specially in loading *all* gems specs
> so it end up with eating more memory if you have insalled many gems
> (as I do).
>

Thanks, that works.
81b5e41ae80dc7f1aa57d2bf40e7e7d0?d=identicon&s=25 Shawn Anderson (Guest)
on 2009-02-04 20:11
(Received via mailing list)
Gem::Specification.list.select {|s| s.extensions.size > 0 }.map {|s|
s.name}.uniq.sort
=> ["RedCloth", "eventmachine", "fastthread", "ferret", "hpricot",
"mongrel", "mysql", "narray", "ncurses", "neuro", "rcov", "rfuzz",
"rmagick", "ruby-debug-base", "ruby-fann", "ruby-opengl", "ruby-prof",
"rubygame", "rubysdl", "sandbox", "sqlite3-ruby", "termios", "thin"]
>> Gem::Specification.list.select {|s| s.extensions.size > 0 }.map {|s|
s.name }.uniq.size
=> 23



2009/2/4 Joel VanderWerf <vjoel@path.berkeley.edu>
D15a45a973443d4562051eb675b60474?d=identicon&s=25 Tom Cloyd (Guest)
on 2009-02-04 20:48
(Received via mailing list)
James Gray wrote:
>
> James Edward Gray II
>
>
Ah, the perils of being a part time programmer. Never quite know what
you're doing. I wondered about that 'readline' entry was doing there.

gems, packages, module, libraries, standard, non-standard,
not-so-standard, definitely NOT standard (oops, that's one of mine). I
feel lucky to muddle through, most days, and I DO do that. I actually
get quite a lot of work done with Ruby, without ever quite knowing
how.... ha!

t.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-02-04 21:03
(Received via mailing list)
Tom Cloyd wrote:
>> for, since they don't involve C code.
> get quite a lot of work done with Ruby, without ever quite knowing
> how.... ha!

yes, ruby is quite a "gem" (oops!) :)
Eacf5ed623e72db0b87707baabd6f21a?d=identicon&s=25 Adam Gardner (adamgardner)
on 2009-02-05 00:46
I use Gosu for game development, which I suppose is a wrapper around the
Gosu C++ library from the same developer... I think more people use Gosu
from Ruby than from C++, though I haven't asked. Gosu as a whole is a
wrapper around OpenGL, fmod (or SDL), and Cocoa/Win32/GTK (depending on
platform).

I also used RubyCocoa to allow me to construct a native OS X application
in Ruby... I'm not sure how you'd classify that into one of the
categories... it's kind of a wrapper, but around a whole language
(Objective-C) instead of a library. Apple calls it a bridge. I'm not
sure what the utility of having it available in JRuby would be, since
most RubyCocoa apps are distributed as self-contained bundles which
don't rely on an interpreter being already present on the end user's
machine, but it'd be neat to see it.

Other than that, ruby-debug and ruby-prof, same as everyone else.
3131fcea0a711e5ad89c8d49cc9253b4?d=identicon&s=25 Julian Leviston (Guest)
on 2009-02-05 01:00
(Received via mailing list)
How would it be technically possible to do jruby cocoa If the machines
weren't macs?

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 05/02/2009, at 10:46 AM, Adam Gardner <adam.oddfellow@gmail.com>
Eacf5ed623e72db0b87707baabd6f21a?d=identicon&s=25 Adam Gardner (adamgardner)
on 2009-02-05 01:54
Julian Leviston wrote:
> How would it be technically possible to do jruby cocoa If the machines
> weren't macs?
>
> Blog: http://random8.zenunit.com/
> Learn rails: http://sensei.zenunit.com/
>
> On 05/02/2009, at 10:46 AM, Adam Gardner <adam.oddfellow@gmail.com>

It wouldn't be, but, so? Who says you can't use JRuby on a Mac?

Perhaps you're following the MVC pattern, and the Model and perhaps
Controller are written using normal old ruby code (perhaps with some
java stuff thrown in), and then you create a distinct View for different
platforms. Of course, I'm sure you could use Swing or AWT or something
(I'm not too familiar with Java GUI frameworks)... it'd be a lot less
effort, but with OS X GUI applications, if the interface is not done in
Cocoa or Carbon, it usually sticks out like a sore thumb.

Again, I'm not particularly sure it'd be worth the effort involved, but
I'd certainly expect it to be possible. Most of the heavy lifting in
RubyCocoa is done with libffi anyway; it'd probably be possible to
switch it to ruby-ffi.

More likely, though, the RubyCocoa project will (eventually) disappear
entirely, replaced by MacRuby, which is pretty much to Objective-C what
JRuby is to Java.
Ea3084bf9444c7d0cd0c640ca0ac93b3?d=identicon&s=25 Logan Barnett (Guest)
on 2009-02-05 02:30
(Received via mailing list)
On Feb 4, 2009, at 5:54 PM, Adam Gardner wrote:

> It wouldn't be, but, so? Who says you can't use JRuby on a Mac?
I certainly use JRuby on Mac!
However, I think Julian is asking if his JRuby Cocoa app will run on
things that aren't Macs. My thought is no. Cocoa would need to be
running on the other platforms for that to work. My understanding is
that Apple provides some Java libs that hook into Cocoa, which makes
JRuby development possible.

> Perhaps you're following the MVC pattern, and the Model and perhaps
> Controller are written using normal old ruby code (perhaps with some
> java stuff thrown in), and then you create a distinct View for
> different
> platforms. Of course, I'm sure you could use Swing or AWT or something
> (I'm not too familiar with Java GUI frameworks)... it'd be a lot less
> effort, but with OS X GUI applications, if the interface is not done
> in
> Cocoa or Carbon, it usually sticks out like a sore thumb.

Java Swing apps (including JRuby ones, like when you write a
Monkeybars app - http://monkeybars.rubyforge.org/) by default on Macs
will render components using the System Look and Feel, which under the
hood will use the OS's native code to render buttons and other
widgets. Check out an app like FrostWire (http://www.frostwire.com/ -
Java) or JotBot (http://getjotbot.com/ - JRuby with Monkeybars)

SWT (not to be confused with AWT) is much more close to native look
and feels, but I think it marries you a lot more to a particular
platform. Check out Azureus for an SWT app in Java
(http://www.azureus.com/
). Glimmer is the only JRuby SWT framework I know of -
https://rubyforge.org/projects/glimmer/

Either way you go, it's possible to make apps that look good and look
native, but how many apps look like iTunes that you'd say also look
native? Pages doesn't look like iTunes, yet it looks native. What
about Colloquy? I think a native look is a fuzzy definition. The most
important thing is that you app does something useful, and does it
easily. That's not to say there isn't value in making a nice interface
that looks like it belongs on the OS with all of the other apps. (:
3131fcea0a711e5ad89c8d49cc9253b4?d=identicon&s=25 Julian Leviston (Guest)
on 2009-02-05 03:04
(Received via mailing list)
The cocoa objective-c java bridge is deprecated from my understanding,
and cocoa is copyright, so there'd be little point, tho I dunno why
jruby couldn't theoretically run the cooaruby code

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/
Ea3084bf9444c7d0cd0c640ca0ac93b3?d=identicon&s=25 Logan Barnett (Guest)
on 2009-02-05 04:41
(Received via mailing list)
On Feb 4, 2009, at 7:02 PM, Julian Leviston wrote:

> The cocoa objective-c java bridge is deprecated from my
> understanding, and cocoa is copyright, so there'd be little point,
> tho I dunno why jruby couldn't theoretically run the cooaruby code

I'm not sure about the deprecation, although that typically doesn't
mean much in the Java world (:
I don't understand what you mean by copyright (unless you mean that
you can't port it to another platform).
If the CocoaRuby stuff calls out to native C bindings, JRuby won't be
able to use it unless the bindings were made against FFI (I'm not sure
what the exact process is, but FFI extensions work great in JRuby,
whereas gems and other libs that depend on native C code don't work at
all in JRuby). I strongly believe that CocoaRuby uses native
extensions, but I could be wrong (:
Eacf5ed623e72db0b87707baabd6f21a?d=identicon&s=25 Adam Gardner (adamgardner)
on 2009-02-05 19:10
Logan Barnett wrote:
> On Feb 4, 2009, at 7:02 PM, Julian Leviston wrote:
>
>> The cocoa objective-c java bridge is deprecated from my
>> understanding, and cocoa is copyright, so there'd be little point,
>> tho I dunno why jruby couldn't theoretically run the cooaruby code
>
> I'm not sure about the deprecation, although that typically doesn't
> mean much in the Java world (:
> I don't understand what you mean by copyright (unless you mean that
> you can't port it to another platform).
> If the CocoaRuby stuff calls out to native C bindings, JRuby won't be
> able to use it unless the bindings were made against FFI (I'm not sure
> what the exact process is, but FFI extensions work great in JRuby,
> whereas gems and other libs that depend on native C code don't work at
> all in JRuby). I strongly believe that CocoaRuby uses native
> extensions, but I could be wrong (:

I'm not 100% sure of the low-level mechanisms involved, but I do know
that RubyCocoa makes heavy use of FFI (that's libffi the C library, not
ruby-ffi), along with a Framework/Library metadata system called
BridgeSupport and a automatic generator of said metadata called
gen_bridge_metadata.rb . That being said, I believe there are also some
native extensions used in areas where metadata-based support was
particularly thorny.
Eacf5ed623e72db0b87707baabd6f21a?d=identicon&s=25 Adam Gardner (adamgardner)
on 2009-02-05 19:54
Logan Barnett wrote:
> On Feb 4, 2009, at 5:54 PM, Adam Gardner wrote:
>> Perhaps you're following the MVC pattern, and the Model and perhaps
>> Controller are written using normal old ruby code (perhaps with some
>> java stuff thrown in), and then you create a distinct View for
>> different
>> platforms. Of course, I'm sure you could use Swing or AWT or something
>> (I'm not too familiar with Java GUI frameworks)... it'd be a lot less
>> effort, but with OS X GUI applications, if the interface is not done
>> in
>> Cocoa or Carbon, it usually sticks out like a sore thumb.
>
> Java Swing apps (including JRuby ones, like when you write a
> Monkeybars app - http://monkeybars.rubyforge.org/) by default on Macs
> will render components using the System Look and Feel, which under the
> hood will use the OS's native code to render buttons and other
> widgets. Check out an app like FrostWire (http://www.frostwire.com/ -
> Java) or JotBot (http://getjotbot.com/ - JRuby with Monkeybars)
>
> SWT (not to be confused with AWT) is much more close to native look
> and feels, but I think it marries you a lot more to a particular
> platform. Check out Azureus for an SWT app in Java
> (http://www.azureus.com/
> ). Glimmer is the only JRuby SWT framework I know of -
> https://rubyforge.org/projects/glimmer/
>
> Either way you go, it's possible to make apps that look good and look
> native, but how many apps look like iTunes that you'd say also look
> native? Pages doesn't look like iTunes, yet it looks native. What
> about Colloquy? I think a native look is a fuzzy definition. The most
> important thing is that you app does something useful, and does it
> easily. That's not to say there isn't value in making a nice interface
> that looks like it belongs on the OS with all of the other apps. (:

Point conceded that the most important thing is that your app does
something useful. And you'll never hear me argue, ever, that Apple
follows their own HIG with high consistency. What I'm referring to has a
lot to do with small details in layout and behavior that do not make an
app any less useful; Azureus is the only bittorrent client I use, and
the interface, though sometimes imperfect in its rendering, does not get
in my way in any significant manner. But it remains a fact that the
differences *are* noticeable, at least in the Java applications I've
used.

Ultimately, I brought up RubyCocoa not because I thought it would be
useful in JRuby, but because it was useful for me and it hadn't been
mentioned yet so far. JRuby and RubyCocoa/MacRuby really fill entirely
different needs. RubyCocoa was very useful for me as someone who needed
to make an application which called native OS X APIs*, but who only knew
Ruby, not Objective-C. I wouldn't ever use it to make a cross-platform
application, any more than I would use the ruby-win32 api for a
cross-platform application. That's not the point of having it.

*For reference, the things RubyCocoa allowed me to do were: registering
for NSWorkspace notifications to nicely handle not bugging the user if
the reason the application is being quit is because the user is logging
out (among other things); save user preferences using the NSUserDefaults
API and thus be able to manage those prefs via WorkGroup Manager (not
that I'm currently doing so, but I now could); add auto-updating
functionality via the Sparkle framework; use Interface Builder to create
the UI (say what you will, I really like Interface Builder as a tool);
define a dynamic dock menu. Some of these things undoubtably would have
been possible without directly calling Objective-C APIs. With RubyCocoa,
none of these were not only possible, they were fairly *easy*, and I
don't even know Objective-C to begin with. Ultimately, it's a matter of
choosing the right tool for the job.
This topic is locked and can not be replied to.