Forum: Ruby You want a Ruby extension? Talk to me, baby

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.
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 Joe Van Dyk (Guest)
on 2006-01-08 09:29
(Received via mailing list)
Hi,

I've figured that it's probably worth my time to learn how to better
write Ruby extensions (as a way to practice my C).

Are there any C or C++ libraries out there that someone would
appreciate an open-sourced Ruby extension for?

Thanks,
Joe
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2006-01-08 09:41
(Received via mailing list)
On 1/8/06, Joe Van Dyk <joevandyk@gmail.com> wrote:
> Hi,
>
> I've figured that it's probably worth my time to learn how to better
> write Ruby extensions (as a way to practice my C).
>
> Are there any C or C++ libraries out there that someone would
> appreciate an open-sourced Ruby extension for?
>
Improving, expanding, cleaning up and otherwise working on the mysql c
binding would certainly be something I'd appreciate.  Though I do not
know the status of it's development activity...
32edd0717b3144d5c58a352d613abdc9?d=identicon&s=25 gabriele renzi (Guest)
on 2006-01-08 13:13
(Received via mailing list)
Joe Van Dyk ha scritto:
> Hi,
>
> I've figured that it's probably worth my time to learn how to better
> write Ruby extensions (as a way to practice my C).
>
> Are there any C or C++ libraries out there that someone would
> appreciate an open-sourced Ruby extension for?

enhancing/updating ruby-gst, the bindings for gstreamer.
IIRC there are no updates to hstreamer 0.10, yet.
7264fb16beeea92b89bb42023738259d?d=identicon&s=25 Christian Neukirchen (Guest)
on 2006-01-08 13:55
(Received via mailing list)
Joe Van Dyk <joevandyk@gmail.com> writes:

> Hi,
>
> I've figured that it's probably worth my time to learn how to better
> write Ruby extensions (as a way to practice my C).
>
> Are there any C or C++ libraries out there that someone would
> appreciate an open-sourced Ruby extension for?

I'd *love* to see a binding for Metakit:
http://www.equi4.com/metakit/
Bf6862e2a409078e13a3979c00bba1d6?d=identicon&s=25 Gregory Seidman (Guest)
on 2006-01-08 14:47
(Received via mailing list)
On Sun, Jan 08, 2006 at 05:29:01PM +0900, Joe Van Dyk wrote:
} Hi,
}
} I've figured that it's probably worth my time to learn how to better
} write Ruby extensions (as a way to practice my C).
}
} Are there any C or C++ libraries out there that someone would
} appreciate an open-sourced Ruby extension for?

How about libical? It seems to be the gold standard for ical file stuff
and
the pure Ruby ical APIs I've tried to use don't seem to do the job as
well
as I'd like.

} Thanks,
} Joe
--Greg
Ce60c4f78a63b0695e4dafc4bd7964f7?d=identicon&s=25 Lou Vanek (Guest)
on 2006-01-08 15:17
(Received via mailing list)
if you want to wade into the deep end, I would like a method that would
tell me about everything that is in scope when the method is called,
and classify the objects-in-scope as instance variables, class
variables, class
names, global constants, local variables, module names--whatever they
might be.
Symbol.all_symbols is just a tease.

The next thing i would like to do is to be able to "unwind" the
scope by going "up" one level and perform the same symbol dump as
defined above,
except with the new scope. Recurse until at top level. Being able to
filter on
any particular class of object would just be icing.

Not even sure if this is possible, but it would sure be educational.
8ecb8bb62c3283f8069a54056c7dc25f?d=identicon&s=25 Jim Freeze (Guest)
on 2006-01-08 15:51
(Received via mailing list)
On Jan 8, 2006, at 2:29 AM, Joe Van Dyk wrote:

> Hi,
>
> I've figured that it's probably worth my time to learn how to better
> write Ruby extensions (as a way to practice my C).
>
> Are there any C or C++ libraries out there that someone would
> appreciate an open-sourced Ruby extension for?

I would like to see the Packet Capture Library (libpcap) updated.
This library includes classes to access the TCP/IP header and
lets you monitor network traffic.
Currently, the code is for Ruby 1.4.x. This is a very interesting
project
and it may be helpful since you are not starting at ground zero.

I have plans to do the conversion, but it is low on my priority list.

If you want the tar file, just send me an email.
1ae92ac1fcb76a88782f461bea73c668?d=identicon&s=25 Victor Reyes (Guest)
on 2006-01-08 16:51
(Received via mailing list)
Joe,
I am new to Ruby and I like to do things the "easy" way.

I use DB2 on my job under AIX, an easy, "natural" binding to DB2 would
be
great.

Also, since you appear to have so much energy, how about tackling the
task
of developing a "native" Ruby GUI environment?
I hate everything that is out there. I mean something like the Java GUI
environment, but for Ruby.

Thank you

Victor
784f760ee2b30a896cefabd91cdf0dba?d=identicon&s=25 Bob Aman (Guest)
on 2006-01-08 18:22
(Received via mailing list)
> How about libical? It seems to be the gold standard for ical file stuff and
> the pure Ruby ical APIs I've tried to use don't seem to do the job as well
> as I'd like.

I second the vote for getting libical going in a Ruby environment.

Also, Victor, you might want to check out Sam Ruby's interface for DB2.
http://www.intertwingly.net/blog/2005/12/12/DB2-in...

Cheers,
Bob Aman
5befe95e6648daec3dd5728cd36602d0?d=identicon&s=25 Robert Klemme (Guest)
on 2006-01-08 18:43
(Received via mailing list)
Lou Vanek <vanek@acd.net> wrote:
> icing.
> Not even sure if this is possible, but it would sure be educational.

You can get quite far with set_trace_func:
http://ruby-doc.org/core/classes/Kernel.html#M001978

Just store the binding on a stack for all events like "call" and remove
it
for "return".

I'm sure with a decent C extension this will be more efficient and
probably
more feature rich.

Kind regards

    robert
5befe95e6648daec3dd5728cd36602d0?d=identicon&s=25 Robert Klemme (Guest)
on 2006-01-08 18:49
(Received via mailing list)
Gregory Brown <gregory.t.brown@gmail.com> wrote:
> binding would certainly be something I'd appreciate.  Though I do not
> know the status of it's development activity...

I'm not sure about MS SQL bindings but IIRC they use ODBC and hence are
only
present on Windows builts.  If so, integrating http://www.freetds.org
then
would be a good idea.

    robert
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2006-01-08 21:14
(Received via mailing list)
On 1/8/06, Robert Klemme <bob.news@gmx.net> wrote:
> > Improving, expanding, cleaning up and otherwise working on the mysql c
> > binding would certainly be something I'd appreciate.  Though I do not
> > know the status of it's development activity...
>
> I'm not sure about MS SQL bindings but IIRC they use ODBC and hence are only
> present on Windows builts.  If so, integrating http://www.freetds.org then
> would be a good idea.

MS SQL uses ODBC or ADO.
There *is* an ODBC for *nix.  No clue on it's reliability.
Ce60c4f78a63b0695e4dafc4bd7964f7?d=identicon&s=25 Lou Vanek (Guest)
on 2006-01-08 22:14
(Received via mailing list)
i wasn't aware of set_trace_func.
good news: it gives you a binding.
bad news: the binding appears to be largely opaque except
for a few "windows" into the binding, such as,

   eval("local_variables", binding)

and, of course, global_variables and 'self', but maybe that's all
there is to a binding.

So your idea of just pushing and popping bindings is probably
sufficient.
Thanks. Interesting idea.
5a601582df3b42b65a5e8353fc9305da?d=identicon&s=25 Gerardo Santana Gómez Garrido (Guest)
on 2006-01-08 22:57
(Received via mailing list)
2006/1/8, Gregory Brown <gregory.t.brown@gmail.com>:
> > >>
> > > Improving, expanding, cleaning up and otherwise working on the mysql c
> > > binding would certainly be something I'd appreciate.  Though I do not
> > > know the status of it's development activity...
> >
> > I'm not sure about MS SQL bindings but IIRC they use ODBC and hence are only
> > present on Windows builts.  If so, integrating http://www.freetds.org then
> > would be a good idea.
>
> MS SQL uses ODBC or ADO.
> There *is* an ODBC for *nix.  No clue on it's reliability.

If this helps, I work with unixODBC + Ruby ODBC + Informix on Solaris
all the time without problems. I wrote an Informix adapter for Rails
this way that works fine

Talking about extensions, I'll attempt to write the native Informix
extension for Ruby. It would be nice to see if someone else find it
useful.

--
Gerardo Santana
"Between individuals, as between nations, respect for the rights of
others is peace" - Don Benito Juárez
http://santanatechnotes.blogspot.com/
1ae92ac1fcb76a88782f461bea73c668?d=identicon&s=25 Victor Reyes (Guest)
on 2006-01-09 03:25
(Received via mailing list)
Bob, Thank you.
D4d28bd014f9e7324bad99dcc3b0d390?d=identicon&s=25 Rich Morin (Guest)
on 2006-01-09 17:28
(Received via mailing list)
At 5:29 PM +0900 1/8/06, Joe Van Dyk wrote:
> Are there any C or C++ libraries out there that someone would
> appreciate an open-sourced Ruby extension for?

http://dynagraph.org

  Dynagraph is a set of dynamic graph drawing engines, based on
  the work of the Graphviz team at AT&T Research, ...

  Dynagraph is a platform-neutral library written in C++. It can
  be used directly in C++ programs, in Windows programs via COM
  wrapper classes, or in other environments using the executable
  with input and output over pipes.

-r
--
Technical editing and writing, programming, and web development:
  http://www.cfcl.com/rdm/resume.html

Contact information: rdm@cfcl.com, +1 650-873-7841
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-01-09 20:05
(Received via mailing list)
On Jan 8, 2006, at 12:29 AM, Joe Van Dyk wrote:

> Hi,
>
> I've figured that it's probably worth my time to learn how to better
> write Ruby extensions (as a way to practice my C).

Pff, writing extensions sucks.  Just use RubyInline and save yourself
half the hassle.

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 Joe Van Dyk (Guest)
on 2006-01-09 20:56
(Received via mailing list)
On 1/9/06, Eric Hodel <drbrain@segment7.net> wrote:
> On Jan 8, 2006, at 12:29 AM, Joe Van Dyk wrote:
>
> > Hi,
> >
> > I've figured that it's probably worth my time to learn how to better
> > write Ruby extensions (as a way to practice my C).
>
> Pff, writing extensions sucks.  Just use RubyInline and save yourself
> half the hassle.

Is there any documentation on how to use RubyInline to interact with a
C/C++ library?

Joe
260b864377cc125e575de59843cb02b3?d=identicon&s=25 Clifford Heath (Guest)
on 2006-01-10 03:39
(Received via mailing list)
Joe Van Dyk wrote:
> Are there any C or C++ libraries out there that someone would
> appreciate an open-sourced Ruby extension for?

I might be out of date, perhaps it's been done and I don't
know, but I'd really like a bridge between Ruby-GTK and
ImageMagick, to display dynamically generated images from
IM using GTK.
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-01-10 20:37
(Received via mailing list)
On Jan 9, 2006, at 11:56 AM, Joe Van Dyk wrote:

>
> Is there any documentation on how to use RubyInline to interact with a
> C/C++ library?

There's a complete tutorial that ships with RubyInline.

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-01-10 20:40
(Received via mailing list)
On Jan 9, 2006, at 6:38 PM, Clifford Heath wrote:

> Joe Van Dyk wrote:
>> Are there any C or C++ libraries out there that someone would
>> appreciate an open-sourced Ruby extension for?
>
> I might be out of date, perhaps it's been done and I don't
> know, but I'd really like a bridge between Ruby-GTK and
> ImageMagick, to display dynamically generated images from
> IM using GTK.

You don't need an extension for that.  You've already got Ruby-GTK
and RMagick.  Just glue them together with Ruby.

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
912c61d9da47754de7039f4271334a9f?d=identicon&s=25 unknown (Guest)
on 2006-01-10 20:46
(Received via mailing list)
Quoting Eric Hodel <drbrain@segment7.net>:

> You don't need an extension for that.  You've already got
> Ruby-GTK and RMagick.  Just glue them together with Ruby.

He's probably wondering specifically how to get from an RMagick
image to a GdkPixbuf or similar (a question I don't know the answer
to offhand), in pure Ruby.

-mental
4913bcb685792f601ae9813b4713abb9?d=identicon&s=25 Detlef Reichl (Guest)
on 2006-01-10 21:32
(Received via mailing list)
Am Mittwoch, den 11.01.2006, 04:44 +0900 schrieb mental@rydia.net:
> Quoting Eric Hodel <drbrain@segment7.net>:
>
> > You don't need an extension for that.  You've already got
> > Ruby-GTK and RMagick.  Just glue them together with Ruby.
>
> He's probably wondering specifically how to get from an RMagick
> image to a GdkPixbuf or similar (a question I don't know the answer
> to offhand), in pure Ruby.
>
Its very easy:

my_pixbuf = Gdk::Pixbuf.new(rmagic_image.to_blob,
Gdk::Pixbuf::ColorSpace::RGB, false, 8, image_width, image_height,
image.width * 3)

the API reference for the gdk-pixbuf call is:
Gdk::Pixbuf.new(data, colorspace, has_alpha, bit_per_sample, width,
height, rowstride)

rmagic_image.to_blob returns the pixel data

cheers
detlef
163755a5d3a5c57bd79c4f41bdda7a22?d=identicon&s=25 Clifford Heath (Guest)
on 2006-01-10 23:29
(Received via mailing list)
Detlef Reichl wrote:
> Its very easy:

Absolutely *magick*. Thanks all.

Clifford.
C2f5b494a2426a37e9885298a5ea0002?d=identicon&s=25 clc (Guest)
on 2006-04-07 20:01
(Received via mailing list)
Hello,  I'm trying to load an 8x8 GIF file and embed it directly into
some
HTML but the image pixels are out of order and the dimensions are not
correct.  I assume the problem is with the byte order during the read.
Can
any of you suggest a better way to do this?

#########################################
require 'base64'

gif_path = 'C:\work\gifTest\gifTest.gif'
html_path = 'C:\work\gifTest\gifTest.html'

f = File.open( gif_path, "rb" )
data = f.read
f.close

encoded = Base64.encode64( data )

f = File.open( html_path, 'w' )

# links work perfectly
f.puts( "<IMG SRC=file:///C:/work/gifTest/gifTest.gif>" )
f.puts( "<IMG SRC=file:///#{gif_path}>" )

# something appears, but out-of-order and wrong dimension
f.puts( "<IMG SRC=\"javascript:'#{data}'\">" )

# these produce the "missing image" placeholder
f.puts( "<IMG SRC=\"data:image/gif;base64,#{data}\">" )
f.puts( "<IMG SRC=data:image/gif;base64,#{data}>" )
f.puts( "<IMG SRC=javascript:'#{data}'>" )

f.close
#########################################
This topic is locked and can not be replied to.