Forum: JRuby Uniform Qt bindings for JRuby and Ruby

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.
990844e0588dcda591a05f94ae585349?d=identicon&s=25 Cees Z. (ceesz)
on 2012-05-17 16:10
Hi everyone,
I have just uploaded a new Gem package (qt_connect) with the aim to
provide a uniform Qt API for both Ruby and JRuby platforms. The Gem
provides JRuby bindings to the Qt Jambi Java library with an (optional)
extension to provide backward compatibility with existing Qt Ruby
programs.
The same Gem package provides for Qt Ruby programs a QtJambi inspired
interface to the Signals/Slots system without the need to use C++
signatures.

download from RubyGems.org: gem install qt_connect
project on github: https://github.com/CeesZ/qt_connect

(Qt is a cross-platform application framework that is widely used for
developing application software with a graphical user interface)
09a41a085f93af8644a7e2e35ba987af?d=identicon&s=25 Charles N. (headius)
on 2012-05-17 19:10
(Received via mailing list)
Very nice!

I see you're using QtJambi here...basically just wrapping it?

I'm glad to see interest in making common GUI APIs for JRuby and Ruby :)

- Charlie
09a41a085f93af8644a7e2e35ba987af?d=identicon&s=25 Charles N. (headius)
on 2012-05-17 19:10
(Received via mailing list)
Oh, obviously you said you're using QtJambi :)

Still, very nice. Would be worth a blog post showing a GUI app running
with Qt in both JRuby and Ruby without modification.

- Charlie

On Thu, May 17, 2012 at 12:07 PM, Charles Oliver Nutter
4fd6f6b507aa3ac75b6cb8ab26fde1c5?d=identicon&s=25 Eric C. (echristopherson)
on 2012-05-18 22:13
(Received via mailing list)
On Thu, May 17, 2012 at 12:09 PM, Charles Oliver Nutter
<headius@headius.com> wrote:
>>
>>> provides JRuby bindings to the Qt Jambi Java library with an (optional)
>>> developing application software with a graphical user interface)
Sounds nice. is QtJambi being actively maintained? I recall that a
while ago Nokia's site said it had been discontinued, at least as a
corporate project.
Bob Lehman (Guest)
on 2012-05-19 02:44
(Received via mailing list)
I am trying to get oracle blob data out of an oracle table.  I can do
simple sql selects of a table that has the following schema.

CREATE TABLE test_blob (
            id               NUMBER(15)
           , image_name       VARCHAR2(1000)
           , image            BLOB
           , timestamp        DATE
       );

using the code below.  But I do not have a clue how I would pull the
blob data out.  I tried hacking some Java directly in without much luck
and it looked really out of place.

Does anyone have any examples of how to do this?




require 'java'

java_import 'oracle.jdbc.OracleDriver'
java_import 'java.sql.DriverManager'

oradriver = OracleDriver.new
DriverManager.registerDriver oradriver
conn = DriverManager.get_connection('jdbc:oracle:thin:@localhost/wind',
'wcadmin', 'wcadmin')
conn.auto_commit = false

stmt = conn.prepare_statement('select image_name from test_blob');

rowset = stmt.executeQuery()
while (rowset.next()) do
  puts rowset.getString(1)
end



Thanks
--Bob

--
Bob Lehman

Email: blehman12@comcast.net
Mobile: (503)888-1471
Christian MICHON (Guest)
on 2012-05-19 10:09
(Received via mailing list)
On Sat, May 19, 2012 at 2:50 AM, Bob Lehman <blehman12@comcast.net>
wrote:
> using the code below. But I do not have a clue how I would pull the
> blob data out. I tried hacking some Java directly in without much luck
> and it looked really out of place.
>
> Does anyone have any examples of how to do this?

yes. I would advise using a ORM instead of doing it all by hand...

> DriverManager.registerDriver oradriver
>
feedbacks:
- using a prepared statement which is constant (not '?' as potential
argument) is not needed here. A simple statement would do...
- with your code, you'll be getting strings, not binary content.

instructions:
1/ jgem install sequel

2/ code with sequel here: http://pastie.org/3934407

Hope this helps.

--
Christian
F592698b26e6ebb8d1755c6499f9d31d?d=identicon&s=25 Uwe K. (donv)
on 2012-05-19 17:17
(Received via mailing list)
Hi Bob!

Have you tried:

stmt = conn.prepare_statement('select image_name, image from
test_blob');
rowset = stmt.executeQuery()
while (rowset.next())
  puts rowset.getString(1)
  blob = rowset.getInputStream(2)
  puts blob.available
  # Now read your data from the input stream.
end

I did not try this (I'm on vacation), but that is the standard way of
getting a blob with JDBC.


On 2012-05-19, at 03:50, Bob Lehman wrote:

> using the code below.  But I do not have a clue how I would pull the
> java_import 'oracle.jdbc.OracleDriver'
> rowset = stmt.executeQuery()
> Bob Lehman
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Uwe Kubosch
uwe@kubosch.no
http://kubosch.no/
Maurice Diamantini (Guest)
on 2012-06-02 08:57
(Received via mailing list)
2012/5/18 Eric Christopherson <echristopherson@gmail.com>:

> Sounds nice. is QtJambi being actively maintained? I recall that a
> while ago Nokia's site said it had been discontinued, at least as a
> corporate project.

I'm not sure (but I don't think so).

Also it seems that Cees has cross-posted its announce on several lists
which he doesn't follows.
For some more answer on this subject, see the qtbinding list at:

    http://lists.kde.org/?l=kde-bindings&r=1&b=201205&...

There is a discussion about merging ruby API between qtjambi jruby
bindings
and native Qt ruby qtbindings (if I understand)...

-- Maurice
990844e0588dcda591a05f94ae585349?d=identicon&s=25 Cees Z. (ceesz)
on 2012-06-02 13:50
Maurice Diamantini wrote in post #1062862:
> 2012/5/18 Eric Christopherson <echristopherson@gmail.com>:
>
>> Sounds nice. is QtJambi being actively maintained? I recall that a
>> while ago Nokia's site said it had been discontinued, at least as a
>> corporate project.
>
> I'm not sure (but I don't think so).
>
> Also it seems that Cees has cross-posted its announce on several lists
> which he doesn't follows.
> For some more answer on this subject, see the qtbinding list at:
>
>     http://lists.kde.org/?l=kde-bindings&r=1&b=201205&...
>
> There is a discussion about merging ruby API between qtjambi jruby
> bindings
> and native Qt ruby qtbindings (if I understand)...
>
> -- Maurice

Sorry, my fault. I thought this thread had changed to a different
subject, but I overlooked the above question.

Nokia indeed stopped supporting QtJambi, but turned it into a community
project, which is reasonably active (see http://qt-jambi.org/). For
all platforms a 4.7 version is available and work is progressing on 4.8
see http://qt-project.org/forums/viewthread/16686/

The qtbindings Ruby gem is based on Qt 4.6.3

I did cross-post on the QT Developer Network Language Bindings Forum
(with no replies) and on the kde-bindings@kde.org forum (see the above
link with a reply from Richard Dale, who wrote the original Ruby
bindings, and my response).

The project itself is hosted on https://github.com/CeesZ/qt_connect.
Since releasing the gem, notes for installation on Mac OS X have been
added to the depository.

Quite a few people have downloaded the Gem, but I have had no further
feedback

== Cees
This topic is locked and can not be replied to.