Uniform Qt bindings for JRuby and Ruby

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: GitHub - CeesZ/qt_connect: Qt bindings for JRuby with (optional) extension to provide backward compatibility with Qt Ruby programs. The API is implemented using Qt Jambi, the Java version of the Qt framework. For Qt Ruby programs it provides a QtJambi inspired interface to the Signals/Slots system without the need to use C++ signatures.

(Qt is a cross-platform application framework that is widely used for
developing application software with a graphical user interface)

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 :slight_smile:

  • Charlie

Oh, obviously you said you’re using QtJambi :slight_smile:

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 N.

On Thu, May 17, 2012 at 12:09 PM, Charles Oliver N.
[email protected] 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.

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 L.

Email: [email protected]
Mobile: (503)888-1471

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 L. 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 L.

http://xircles.codehaus.org/manage_email


Uwe K.
[email protected]

2012/5/18 Eric C. [email protected]:

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&w=2

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

– Maurice

On Sat, May 19, 2012 at 2:50 AM, Bob L. [email protected]
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

Maurice Diamantini wrote in post #1062862:

2012/5/18 Eric C. [email protected]:

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&w=2

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 The Qt Project

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 [email protected] 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 GitHub - CeesZ/qt_connect: Qt bindings for JRuby with (optional) extension to provide backward compatibility with Qt Ruby programs. The API is implemented using Qt Jambi, the Java version of the Qt framework. For Qt Ruby programs it provides a QtJambi inspired interface to the Signals/Slots system without the need to use C++ signatures..
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