A small change in your code should get the right data: @jdoc = JSON.parse(result) @uid = @json['owner']['uid'] #=> "bb4123ac7950435eb516e2a47940b675" Also, you're trying to convert a string: "bb4123ac7950435eb516e2a47940b675" into integer: to_i() in your code. Which would be 0 as uid is a string of alphanumeric characters, and not a combination of...
Well, this is hardly sufficient to explain what is going on, but I can make it work if in config.ru I replace run Sinatra::Application with Sinatra::Application.run! In fact, knowing that makes me even more confused. Some sort of bug in Rack?...
ruby-on-rails,ruby,postgresql,rails-activerecord,jruby
Simply fixed the issue by updating database related gems, using the bundle update command.
java,ruby,logging,jax-rs,jruby
I just noticed that I was able to use slf4j too log = org.slf4j.LoggerFactory.getLogger(self.class.name) The logging level depends on what we set at the root level in config.yaml. Only if that is set to DEBUG, we can see log.debug entries. logging: # The default level of all loggers. Can be...
project maintainer here. That's a clear sheos4 bug/regression - thanks for finding it. This should go to the bug tracker of the project - I opened an issue for it and set it for the next release. In the meantime, please use the shoes launcher :) Feel free to report...
ruby-on-rails,amazon-s3,jruby,jrubyonrails,torquebox
It is generally considered bad practice to block a web request handler on a network request to a third party service. If that service should become slow or unavailable, this can clog up all your web processes, regardless of what ruby you are using. This is what you are referring...
I got this to work by setting JVM options JRuby-style: export JRUBY_OPTS="-J-Dlog4j.debug=true -J-Dlog4j.configuration=file:/absolute/path/to/log4j.properties" trinidad This overwrote log4j.properties specified in my Java jar and I was able to manipulate log levels of Java classes in (and called by classes explicitly in) the jar file....
Explained here on how to call existing Java code from JRuby. The most basic usage: require 'java' java.lang.System.out.println("Hello, world!") As a bit more complex example, if you want to import your arbitrary package (say, 'foo.bar.baz') from a JAR, you can do this: require 'java' require 'foobarbaz.jar' def foo Java::Foo end...
simply specify an Object or IRubyObject argument signature in the method and it will work just fine when you call the Java method from your Ruby script ... UPDATE: assuming a LogStash::Event you can either make the Java signature accept (IRubyObject event) and than use event.callMethod("cancelled?").isTrue() and similar on the...
jboss,environment-variables,jruby,warbler
You could setup a datasource on the application server https://docs.jboss.org/author/display/WFLY8/DataSource+configuration And in your application you will need to use ActiveRecord-JDBC-Adapter https://github.com/jruby/activerecord-jdbc-adapter Or you can also set environment variables in the application servers's startup script (bin/standalone.sh or bin/domain.sh)...
ruby,multithreading,hash,parallel-processing,jruby
Hash isn't thread safe. If keep_item? visits the hash, there will be race condition. Even if it doesn't, there are concurrent updates to the hash, which is error prone. If there's no lock or other synchronization, theoretically there's no guarantee that the updates to a non-thread-safe hash on one thread...
ruby-on-rails,jruby,jrubyonrails,jruby-openssl
I ended up uninstalling 0.9.7 version. gem uninstall -i /usr/local/rvm/gems/[email protected] jruby-openssl ...
java,multithreading,swing,jruby
consider JRuby as any other JVM language ... with no special care for Swing/AWT conventions built-in - only a "new" syntax for writing a Swing GUI. as such do care about EDT just like you would in Java.
I resolved my issue. Here is the updated command I used to install the gems: java -Xmx500M -classpath lib\jcodings.jar;lib\joda-time.jar;lib\jruby-complete.jar org.jruby.Main --command gem install GEM --user-install
We can use JDBC, instead of oci8. oci8 needs c extenssions which has been deprecated in jruby. See this for a working example :: https://gist.github.com/rogerleite/217543...
include Java import org.apache.hadoop.hbase.HBaseConfiguration import org.apache.hadoop.hbase.client.HTable import org.apache.hadoop.hbase.client.Get import org.apache.hadoop.hbase.util.Bytes tableName = 'some_table' conf = HBaseConfiguration.create ht = HTable.new(conf, tableName) key = '7af02800f4c6478cde0f55e8bce34f4a2efa48f2' my_get = Get.new(key.to_java_bytes) result = ht.get(my_get) # This puts Bytes.toStringBinary(result.getValue('foo'.to_java_bytes, 'bar'.to_java_bytes)) ...
as suggested by the comment already linking to RVM reports Gemfile ruby as not installed RVM's support for resolving a Ruby "engine" from the Gemfile is limited and does not match how Heroku is using (parsing) the directive. if you really want to have it both in the Gemfile use...
ruby-on-rails,ruby,jruby,threadcontext
finally figured out by reading Mozilla rhino's code: https://github.com/matthieu/rhymeno/blob/master/src/org/mozilla/javascript/Context.java#LC416 static final Context enter(Context cx, ContextFactory factory) Basically the method counts the number of threads that are inside the context ( using it / executing it) and if another thread tries to enter it , it throws an error. To avoid...
JRuby 1.7.19 incompatibility (probably related to updated RubyGems), try downgrading JRuby (e.g. 1.7.16 should work fine) for the time being ... or look for a possible resolution of the issue
As others have said, this is not possible with CompiledScript. However, with JRuby you have another option. You can use the command line tool jrubyc to compile a Ruby script to Java bytecode like so: jrubyc <scriptname.rb> This will produce a class file named scriptname.class. You can run this class...
This looks like a JVM bug in jdk 1.8_45 see this link for more info https://bugs.openjdk.java.net/browse/JDK-8065318...
OK, so the server admin and I spent two days trying to figure these things out and I can finally summarize the solution we ended up with to get JRuby working on AIX_64. 1 . First and most important of all, I had to install JRuby 1.7.9 since the 1.7.16...
maybe, just search for the package declaration :) https://github.com/jruby/jruby/tree/master/core/src/main/java/org/jruby/javasupport
ruby,user-interface,jruby,jruby-win32ole
Just one line to add showFactInWindow('fact', 89) ...
This isn't a great answer, but I was having a similar issue on jruby 1.7.3 and using 1.7.10 fixed it. I'd still like to know what the issue with 1.7.3 was though, since that's the version everyone else on my team is using.
Maybe the << does not add all the individual jars to the classpath? You might have to look for something else to include all jars in lib and lib/akka. Unfortunately I don't know enough JRuby to tell you how to do it. Also: you are importing classes (ActorRegistry, Actors) that...
Looking more closely at https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby#closure-conversion I see this statement: The block is converted to a Proc object, which is then decorated with a java interface proxy that invokes the block for any method called on the interface. I think this means there is no way to tell what method called...
There is no setter for style on ProgressBar, so you have to set it at creation time in the constructor. Note that SplashActivity can conflict with the Ruboto SplashActivity.java, so I use another name (ProgressBarActivity) require 'ruboto/widget' require 'ruboto/util/toast' ruboto_import_widgets :Button, :LinearLayout, :TextView, :ProgressBar class ProgressBarActivity AndroidAttr = JavaUtilities.get_proxy_class('android.R$attr') def...
This question already exists: JRuby script with Rubeus and Swing exiting once packaged into jar using warble Add at the bottom of the main script: event_thread = nil SwingUtilities.invokeAndWait { event_thread = java.lang.Thread.currentThread } event_thread.join ...
When you use the modular style, the Sinatra::Application app still exists, but usually nothing happens to it. In your config.ru you are running this (empty) app instead of your own. Simply change run Sinatra::Application to run App ...
Removing the spec.add_development_dependency "optparse" spec.add_runtime_dependency "optparse" did the trick and now the gem compiles into a runnable JAR file. ...
ruby-on-rails,rvm,passenger,jruby,jrubyonrails
If you're using Passenger under Apache, you should use SetEnv in your vhost to set the environment variables to use with the process. http://httpd.apache.org/docs/2.4/mod/mod_env.html SetEnv JRUBY_OPTS -J-Xmx1024m ...
ruby-on-rails,jruby,rails-postgresql
It is caused by the activerecord-jdbc-adapter gem which includes some of the core AR functionality, since it supports multiple AR releases from a single AR-JDBC gem release. Due changes in ActiveRecord's PostgreSQL adapter support it seems to double load ArrayParser. Please note that supporting Rails 4.2 requires work here and/or...
I do not know why rvm use is not working You can add .rvm/rubies/jruby-1.7.12/bin to your $PATH (try editing .bashrc for linux, .bash_profile for osX), restart console and run 'jruby -v'. It should be 1.7.12. Hope that solves your problem....
ruby-on-rails,postgresql,jruby,mahout,jrubyonrails
Have you looked at PredicitonIO? They have several recommenders built on Spark and include a Ruby SDK. Check their template gallery and check their Ruby SDK. Mahout has a new recommender component that is meant to work with a search engine. If you want something extremely flexible you can check...
Try using bundler gem install bundler Create the file Gemfile at the root of your project and write the dependencies on it: gem 'timers' Now warbler will add the dependencies correctly....
java,c,ruby,jruby,ruby-c-extension
(Disclaimer: this might not be a complete answer but it was too long for a comment) Although I have next to no experience with JRuby's implementation in particular, dynamic languages implemented on the JVM have their limitations in terms of the speed you can get compared to what you would...
java,ruby-on-rails,ruby,jruby,.class-file
try Warbler with the compiled feature ... it does ~ the same but creates a dummy .rb file that loads the .class version (it's not clear from your notes or the old AOT wiki whether you tried that explicitly) you should look inside the generated .war file (it's a .zip)...
seems like the work needed to create an interface (so that you abstract away from JRuby's Java/embed APIs) is done - as you've find out. the project already packages using Maven including the JRuby jar and the ruby dependencies for the premailer gem. while those are not to be found...
The suggestion by Joe to use Runtime.getRuntime().halt(int) works. Thanks
ruby-on-rails,ruby,azure,jruby,sonarqube
It's possible, I just discovered, after spending 6 pretty frustrating hours on this issue. Here are the issues I encountered and the solutions I came up with for each: Couldn't connect to the Azure SQL Server database -- connection would just time out. The solution was to add ";ssl=require" to...
ruby,cucumber,jruby,factory-girl
If you're on rails, You could use a combination of camelecase/classify and constantize > model = "#{'my_database'.camelcase}::#{'here_is_some_table'.camelcase}".constantize => MyDatabase::HereIsSomeTable # Only work if you actually have such a constant that'll give something like def update_window_for_ctm_staging_extract(target_database, target_table, table_name) model = "#{'target_database'.camelcase}::#{'target_table'.camelcase}".constantize model. where(src_tablename: table_name). update(from_date_dttm: from_date_dttm,...
mysql,ruby-on-rails,ruby,activerecord,jruby
Running with Ruby 2.1.x works and not work with JRuby 1.7.x/Ruby 1.9.x. Thanks @ThomasHaratyk
java,linux,jruby,nativelibrary
You can specify -J-Djava.library.path=$LD_LIBRARY_PATH in your jvm server configuration file. Here $LD_LIBRARY_PATH should contain paths to your native libraries.
java,ruby,jruby,minecraft-forge
It looks like these are annotations, so take a look at JRuby's reference on them. It might end up looking something like: java_annotation('Mod(modid="MyModID", name="MyModName")') class MyMod # ... mod stuff end ...
I don't think there's a standard recommended practice, but there are a few options: ruby-maven provides a DSL and a set of Rake plugins to build Java code the Maven way. jruby-gradle-plugin provides similar support for the Gradle build tool. For managing dependency libraries, there's also jar-dependencies. If you're going...
actually, this is far easier than you think and will work fine if you just pass a [] around :) while on the Ruby side JRuby makes sure values are Ruby-like but when it reaches the Java end - in case of a RubyArray instance passed to Java (which actually...
ruby-on-rails-4,jruby,torquebox
Well it turns out it was the bullet gem taking up all the time. It seems that with that many records, detecting whether there is an N+1 query is quite time consuming. Simply disabling bullet reduces the time to exactly what the rails console says it is.
This is an issue with Rack. Version 1.6.0 at the time of writing is causing errors with Sinatra based applications. Use an older gem until this is confirmed resolved.
you need make your brain "forget" the Java style super syntax and simply do it the Ruby way e.g. class SortedProperties < java.util.Properties def keys keyList = java.util.Vector.new super.each do |element| keyList.add(element.to_java(:String)) end java.util.Collections.sort(keyList) return keyList.elements() end end props = java.util.Properties.new props.setProperty 'bbb', 'B' props.setProperty 'aaa', 'A' props.setProperty 'ccc', 'C'...
The DefaultTableModel has no visual display component and needs to belong to a JTable. The JTable itself is used to display the data provided by the model. The JTable view can be changed without affecting the model. Any changes to the model affect the JTable. I don't know the Jruby...
You can probably get this by extracting the first part of your path by defining this in your controller: def context_path(url) URI.join('/' + request.fullpath.split('/')[1], url) end helper_method :context_path Then that's easy to incorporate into your URL: <%= link_to "My Link", context_path('three/four') %> ...
Use System.setProperty(String key, String value) to set the properties you provide in command line. e.g. System.setProperty("jruby.compat.version","RUBY1_8"); You have to set these properties during start up of your application.so,that there will not be any problem of properties missing...
java,postgresql,heroku,jruby,jrubyonrails
Yes, you can do this with the Java APIs in Ruby. It's difficult to provide an exact answer because I do not know what you are trying to do. But here is an example of a method that creates a connection, and manipulates the database in pseudo-JRuby require 'java' java_import...
ruby,recursion,jruby,tail-recursion
Tail recursion is not the difference here. In fact, Ruby does not do anything to optimize tail calls. The difference is that the naive algorithm recursively calls itself twice each time it's called, giving O(2n) performance, which means the runtime goes up exponentially as N increases. The tail-call version runs...
It may be worth to mention, that File.readlines will read everything into memory, what may cause memory issues with large files. Consider using this code: File.foreach('foo.txt').map do |line| Foo.new(line) end It read file line by line, almost as fast as your code, but more secure....
Consider this (with example array in javalocation): javalocation = %w| 1.5.0/opt/itm/v6.2.2/JRE/lx8266/bin/java 1.5.0/opt/itm/v6.2.2/JRE/lx8266/bin/java 1.5.0/opt/itm/v6.2.2/JRE/lx8266/bin/java 1.5.0/opt/itm/v6.2.2/JRE/lx8266/bin/java 1.5.0/opt/itm/v6.2.2/JRE/lx8266/bin/java 1.5.0/opt/itm/v6.2.2/JRE/lx8266/bin/java 1.5.0/opt/itm/v6.2.2/JRE/lx8266/bin/java 1.7.0_72/u01/java/jdk1.7.0_72/jre/bin/java 1.7.0_72/u01/java/jdk1.7.0_72/jre/bin/java 1.7.0_72/u01/java/jdk1.7.0_72/jre/bin/java...
java,nullpointerexception,jruby
I had created ruby type object in my java code by creating new Ruby object... This causes checking fail in updateARGV because a receiver that register variable in BiVariableMap and another receiver that update variable are different. So, I got a Ruby object from new ScriptingContainer(from it we can always...
The trick in this case is to find how to properly import the 3rd party libs. Please download the needed jars using any dependency system (I use ant with ivy). This will download 5 jars based on the qr code library you mentioned: core-2.0.jar core-3.1.0.jar javase-2.0.jar javase-3.1.0.jar jfreesvg-2.1.jar build.xml for...
you just did something completely different (watch for proper casing) : java_import java.awt.Image.MemoryImageSource first resolves java.awt.Image which in your case (unfortunately) exists and than tries to call the MemoryImageSource method on the Java class what you're after is java_import java.awt.image.MemoryImageSource thus JRuby assumes java.awt.image is a package and looks for...
Yes, you add if and miss some end there. Try to use some editor for show you unexpected end. def read_dbf(paste) #Lendo a pasta Dir.foreach(paste) {|name| if File.directory?(name) pasteSub = paste+"/"+name Dir.foreach(pasteSub) {|subname| puts "Pasta: #{pasteSub}" puts subname } end } end ...
Solved it! Short answer is that you should write # ... when ::Hash # ... instead of # ... when Hash # ... Longer story: Turns out that because my method was in a class that inherited from Virtus::Attribute and because there is a Virtus::Attribute::Hash class, I was unwittingly trying...
It's probably getting called in your profile file. Usually, the file is .bash_profile and is located in your home dir....