jruby

Using Sybase ASE 12.5.4 with jTDS drivers with JRuby

谁说胖子不能爱 提交于 2019-12-05 02:07:56
问题 Problem I am trying to build a small ruby script - which will be run using jruby once a day - to connect to a Sybase ASE 12.5.4 database and perform a complex query. Ultimately I intend to do some processing on the data and insert the new data in a MySQL table for use within a rails application. Environment jruby v1.4.0 java v1.6.0_15 on Ubuntu Karmic JRuby Installed Gems activerecord-jdbc-adapter (0.9.1) activerecord-2.3.4 Jruby Lib Directory jtds-1.2.5 Query SET rowcount 10 SELECT * FROM

Using JRuby/Jython for Ruby/Python interoperability?

£可爱£侵袭症+ 提交于 2019-12-05 01:12:19
Quite-probably a silly question, as I don't know much about Java/Jython/JRuby/bytecode, but.. I stumbled across _why's unholy again today.. It allows you to output Python bytecode from Ruby code.. Basically allowing them to produce the same bytecode.. Jython outputs Java bytecode, as does JRuby.. Since these both compile to the same bytecode, does this mean you could potentially use any Python library from Ruby, and Ruby libraries from Python? No, that won't work. At least not the way you think it would. Interoperability between Jython and JRuby works the same way as between CPython and YARV:

CamelCase instead of snake_case in Rails DB

邮差的信 提交于 2019-12-05 00:24:09
问题 My DB tables and field names are in CamelCase. Is it possible to convert those names into snake_case on a fly? To make model methods look pretty? The app is JRubyOnRails 3.0 / MSSQL DB / ActiveRecord-JDBC-adapter. 回答1: @arkadiy,as a matter of fact, I was looking into this just this very day. For table names, we of course have the set_table_name method: class CamelCasedFoo < ActiveRecord::Base set_table_name :CamelCasedTable end For things like primary keys, we have set_primary_key: class

JRuby OpenSSL Error

倖福魔咒の 提交于 2019-12-05 00:20:26
问题 I am having problems configuring JRuby to work properly with OpenSSL. Googling has revealed that this is a pretty common occurence, but none of the solutions I've read have worked for me. Here is my setup: Ubuntu 9.10 jruby 1.5.1 jruby-openssl (0.7) Here is the error: irb(main):001:0> require 'jruby/openssl/gem_only' => true irb(main):002:0> require 'openssl' => true irb(main):003:0> OpenSSL::Digest::OPENSSL_VERSION_NUMBER NameError: uninitialized constant OpenSSL::Digest::OPENSSL_VERSION

Btrieve/Pervasive db and Ruby

强颜欢笑 提交于 2019-12-04 21:44:30
Is there any solution to work with Btrieve/Pervasive db from Ruby level? Any gem? Maybe somebody have some experience with such a thing? Or maybe use some Java libs through Jruby? I've never used Jruby Never worked with that, but if there's a JDBC adapter for it, then it's a good idea to use JRuby. Using JRuby is dead simple, visit JRuby.org . @kell I used jruby and JDBC Pervasive driver. Simple example: require "java" module JavaSql include_package "java.sql" end pervasive_driver = Java::JavaClass.for_name("pervasive.jdbc.PervasiveDriver") conn = JavaSql::DriverManager.getConnection("jdbc

How to use H2 as embedded database in Postgres-compat mode, from jruby/rails

你说的曾经没有我的故事 提交于 2019-12-04 17:58:57
I'd like to launch a jruby/rails app to use Postgres. But I'd like to use H2 in Postgres compatibility mode when running in development and test. Its no problem bringing up the app in H2, or in postgresql, but how do I configure to run the postgresql adaptor, using an embedded H2 database? For example: something like this: database.yml development: # adapter: jdbch2 # database: db/development/database adapter: postgresql encoding: unicode database: database # driver: org.h2.Driver url: jdbc:h2:~/db/development;MODE=PostgreSQL test: ... Gemfile: ... gem 'activerecord-jdbch2-adapter' #gem 'jdbc

possible to load nokogiri in jruby without installing nokogiri-java?

我是研究僧i 提交于 2019-12-04 16:56:16
i need a way to run following nokogiri script #parser.rb require 'nokogiri' def parseit() //... end and call the parseit() while running below main.rb in jruby #main.rb require 'parser' parseit() Of course the problem is jruby cannot find 'nokogiri' as I have not installed it aka nokogiri-java via jruby -S gem install nokogiri The reason is there is some bug I found in nokogiri running under Jruby, so I have only installed nokogiri on Ruby not Jruby. The parser.rb runs perfectly under just Ruby. So my objective is to be able to run parseit() without having to install nokogiri on Jruby!

Compile SASS with Compass in Ant build.xml

假如想象 提交于 2019-12-04 14:13:42
Does anyone know how to use JRuby and Compass modules to compile SASS (*.scss) files within build.xml? I'm able to use the Sass::Exec module within sass standalone installation to compile from *.scss to *.css in the following manner: <!-- Compile SCSS files copied to target folder --> <property name="stylesheetFolder" location="myproject/stylesheet"/> <property name="inputFiles" value="${stylesheetFolder}/[^_]*.scss" /> <echo message="Compiling SCSS files from ${stylesheetFolder}..." /> <script language="ruby" classpath="${env.EP_LIB}/jruby/complete/${jruby-complete.build.jar}"> <![CDATA[

How to extend DataMapper::Resource with custom method

心不动则不痛 提交于 2019-12-04 13:14:26
I have following code: module DataMapper module Resource @@page_size = 25 attr_accessor :current_page attr_accessor :next_page attr_accessor :prev_page def first_page? @prev_page end def last_page? @next_page end def self.paginate(page) if(page && page.to_i > 0) @current_page = page.to_i - 1 else @current_page = 0 end entites = self.all(:offset => @current_page * @@page_size, :limit => @@page_size + 1) if @current_page > 0 @prev_page = @current_page end if entites.size == @@page_size + 1 entites.pop @next_page = (@current_page || 1) + 2 end entites end end end Then I have call of #paginate:

RVM With JRuby 1.7.0 “Unknown Ruby Interpreter”

时光总嘲笑我的痴心妄想 提交于 2019-12-04 12:34:39
问题 I setup a basic Rails application with the following Gemfile: source 'https://rubygems.org' ruby '1.9.3', engine: 'jruby', engine_version: '1.7.0' gem 'rails', '3.2.8' Whenever I change into the project directory I get the following message: Unknown ruby interpreter version: '1.9.3,engine:jruby,engine_version:1.7.0'. I'm running RVM 1.16.17 and have installed 'jruby-1.7.0'. Is my Gemfile engine misconfigued or do I need to change something in RVM? 回答1: RVM has limited support of the ruby