Forum: JRuby Uniform Qt bindings for JRuby and Ruby

C76bb747441840c176dd070c966d12dd?d=identicon&s=25 Cees Zeelenberg (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)
F1d37642fdaa1662ff46e4c65731e9ab?d=identicon&s=25 Charles Nutter (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
F1d37642fdaa1662ff46e4c65731e9ab?d=identicon&s=25 Charles Nutter (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
Abdb670e1c130f96f947a94d03c02efa?d=identicon&s=25 Eric Christopherson (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.
A8ba9c1702d2df9dbd72e2c941fea064?d=identicon&s=25 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
2c0c4cf3ccc8da22f7c3b9586ce1cd70?d=identicon&s=25 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
4bfcb18ca5298df54d8eb410244d004f?d=identicon&s=25 Uwe Kubosch (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/
7ece60b3b5bb235d1b6df89727ca6cf7?d=identicon&s=25 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
C76bb747441840c176dd070c966d12dd?d=identicon&s=25 Cees Zeelenberg (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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.