jruby

Simple Serialization Faster Than JSON? (in Ruby)

I have an application written in ruby (that runs in the JRuby VM). When profiling it, I realized that it spends a lot (actually almost all of) its time converting some hashes into JSON. These hashes have keys of symbols, values of other similar hashes, arrays, strings, and numbers. Is there a serialization method that is suitable for s...

Saving a 'Date' using DataMapper on AppEngine+JRuby

I have a a model as follows: class Total include DataMapper::Resource property :id, Serial property :amount, Float, :default => 0.00 property :day, Date belongs_to :calendar end I am trying to select a specific Total from the data-store. class Calendar include DataMapper::Resource property :id, Serial ...

What do I put in my Ruby (JRuby) code to break into the debugger?

I'm familiarizing myself with some JRuby code, and I'd like to be able to place a breakpoint in the code and run (as usual) from the command-line, having it break into the debugger when it gets to that point. Is there something I can put in my code to force JRuby to break into the debugger? I've tried running jruby -r debug foo.rb (ins...

How can I use the AppEngine::Datastore api's in JRuby like in python?

So in python I would do something like this: from google.appengine.ext import db class Thing(db.Model): name = db.StringProperty() In ruby how would I do this using the AppEngine::Datastore libs? The reason I ask this is because I'm hitting some hard walls using the Datamapper adapter and so I plan on just using the AppEngine ap...

Casting objects in JRuby

I still don't feel like this is adequately answered. how does one do this in jruby: MyClass myobj = new MyClass; InheritsFromMyClass changedobj = (InheritsFromMyClass)myobj; ...

Java Swing Resource for jRuby developer?

I'm looking to develop GUI apps using jRuby but, am not sure which would be a good Swing book or tutorial to start with in my studies. ...

Why does a JRuby application on App Engine take so long to start (versus a Python app)?

I'm considering using JRuby on App Engine but have heard that Juby app on App Engine have a long startup lag versus a Python app. Why is this? Is it because the JRuby jar files are so large that a cold startup requires them to be loaded into memory before the app can start serving? That would be my guess but I'm not sure if that's a p...

SQLServer Binary Data with ActiveRecord and JDBC

I'm using the activerecord-jdbc-adapter with ActiveRecord to be able to access a SQLServer database for Rails Application running under jRuby and am having trouble inserting binary data. The Exception I am getting is below. Note I just have a blurb for the binary data from the fixtures that was working fine for MySQL. ActiveRecord::Stat...

Jruby embedded modules and classes.

Hey, I have a ruby file as follows: module Example class Myclass def t_st "Hello World!" end end end now if this was just a class I would be able to use the following java code: ScriptEngine jruby = new ScriptEngineManager().getEngineByName("jruby"); jruby.eval(new BufferedReader(new FileReader("e...

JRuby: import vs include vs java_import vs include_class

why so many different ways to include Java classes into JRuby? What are the differences? Which one should I use? ...

Why do I get a NoSuchMethod error running Warbler?

I'm getting the following error when running warble under both jRuby 1.3 and 1.4. I'm new to warbler, any suggestions what to try next? $ warble war WarblerWar.java:70:in `addEntry': java.lang.NoSuchMethodError: org.jruby.util.ByteList.getUnsafeBytes()[B from WarblerWar.java:63:in `addEntries' Other info that might help: It's...

How should jruby-jars and jruby-rack be added to the classpath using warbler?

Hi again, I've been reading through the warbler source code, and I can't figure out how the jruby-jars and jruby-rack jars are meant to end up on the servlet classpath? It seems warbler is copying them into web-inf/gems/gems/<gemname>/lib/<jarname>.jar but they are not on the classpath. I'm guessing that if I put them in my ruby apps...

Running RSpec on Google App Engine via JRuby

I'm trying to write some tests (RSpec) against the AppEngine and its datastore. I've tried to load the environment and tests via: appcfg.rb run -S spec app/tests/ And I end up with the following error: spec:19: undefined method `bin_path' for Gem:Module (NoMethodError) I can run non-appengine specs just fine by running: spec ...

How to deal when MS Word 2004 (OSX) is freezing or displaying dialogs?

Hi, I'm using jRuby and a Java library (using itself an applescript to play with MS Word) to convert Word documents to PDF files. Sometimes I get a dialog about margins issues, or MS Word is freezing because the file is too big... Could anyone recommend a script or library that I could run on OSX to manage these issues (closing the dial...

Java Errors with jRuby on Rails on Google App Engine

I followed all of the instructions so far from: http://code.google.com/p/appengine-jruby/wiki/RunningRails and http://gist.github.com/268192 Currently, I'm just trying to get to hello world. I'm getting these errors when I just run the dev_appserver.rb 238:hello-world jwang392$ dev_appserver.rb . => Booting DevAppServer => Pres...

jRuby and Matz's Ruby on the same machine?

Is it possible to run jRuby and native ruby on the same machine? For example installing rake or gem under both it find's Matz Ruby extensions /usr/bin/gem or /usr/bin/rake The MRI gems and jruby gems are mixed up. Is there any experience in that constellation ? Thanks erhard ...

How do I setup a custom Gem.path using JRuby::Rack?

Hi Nick et al, I've been having some fun looking at to source code of JRuby-Rack and Rubygems to try to figure out how to solve a org.jruby.rack.RackInitializationException: no such file to load -- compass in my rackup script cased by require 'compass'. I'm passing in a custom 'gem.path' as a servlet init parameter and it is being c...

How do I make Rack::Reloader re-load changes to haml files?

My jruby rack sinatra compass haml app correctly reloads changes to *.rb files, but does not detect changes to *.haml files. Is this compass doing some caching or a limitation of Rack::Reloader? Any pointers to how to fix? ...

Preventing Rails from opening production.log, when it is deployed with jruby-rack into tomcat.

I have to to deploy a Ruby on Rails application to an tomcat application server using jruby-rack. Due to security reasons my customer has the webapps directory mounted read only and he won't changed this. The problem that arises is, that the rails logger wants to open the WEB-INF/log/production.log in write mode. He writes nothing to thi...

JRuby: how to call a Java variadic function without optional arguments

I have a function with a signature similar to String.format(String, Object...). I want to call this function from JRuby without the last parameters (since it is optional), but my code throws an ArgumentError (wrong # of arguments(1 for 2)) Is there a way to call this function with only 1 argument just like I would do in Java? ...