w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
jruby -S bundle install jruby: No such file or directory -- bundle (LoadError)
Bundler is probably not installed. You can check the output of jruby -S gem list to verify, and then install it with: jruby -S gem install bundler In general, a LoadError means you’re missing a gem dependency.

Categories : Ruby

How to connect to tibco EMS Queue and send a xml file in Ruby not JRuby?
It should be fairly trivial to package up the C interface to EMS in a ruby gem, a la http://guides.rubygems.org/c-extensions/

Categories : Ruby

Java File.exists and other File operations returning wrong results for an existing File (network, macosx)
I think you might be looking for the WatchService. Oracle was also kind enough to provide a tutorial. Because the longevity of these links aren't guaranteed, I'll edit in an example code in a couple of minutes. I just wanted to let you know I think I found something in case you want to start looking at it for yourself. UPDATE Following the linked tutorial, I came up with code like this. I'm not sure it'll work (don't have time to test it), but it might be enough to get you started. The WatchService also has a take() method that will wait for events, which means you could potentially assume the file's existence (or lack thereof) based on the last output you gave. That will really depend on what this program will be interacting with. If this works, good. If not, maybe we can figure out

Categories : Java

Can I run JRuby code from one JVM in another JVM?
Consider using a generic RPC mechanisms such as: RMI (via Java) CORBA via Java or native to Ruby (e.g. R2CORBA) SOAP / web-services Also, consider a Ruby specific solution such as JRuby XMLRPC - https://github.com/jruby/jruby/blob/master/lib/ruby/1.9/xmlrpc/README.rdoc. This is not the kind of thing that JSR223 addresses.

Categories : Java

How do I get launchd to use jruby
I found the answer here: Watir scripts via launchd This is my bash script which sets rvm then runs the ruby script with the specified ruby version: ############ #first arg is task_kind. Pass it on to the ruby script. task_kind=$1 # Load RVM into a shell session *as a function* if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then # First try to load from a user install source "$HOME/.rvm/scripts/rvm" elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then # Then try to load from a root install source "/usr/local/rvm/scripts/rvm" else printf "ERROR: An RVM installation was not found. " fi echo "Launching TaskManagerRunner for $task_kind." #first arg in the next line is the specific ruby needed for the script. #second arg is the script. #third arg is the script param. /Users/haroldsh

Categories : Ruby

aws/s3 gem is not working with Jruby
I found that there is a problem in using aws-s3 gem with jruby. So, I tried it using "aws-sdk" gem jruby -S gem install aws-sdk Write code to upload file to s3 as require 'aws-sdk' file_name = ARGV[0] bucket = ARGV[1] AWS.config( access_key_id: 'PUT ACCESS KEY', secret_access_key: 'PUT SECRET KEY') s3 = AWS::S3.new base_name = File.basename(file_name) o = s3.buckets[bucket].objects[base_name].write(File.open(file_name)) puts '--------------Uploaded!-------------------' o.acl = :public_read_write url = o.public_url puts "#{url}" Save this in ruby file and run it as give below jruby file_name.rb upload_file_name.html path_bucket_where_to_upload Use this DOC , which give idea how to use "gem aws-sdk"

Categories : Ruby

jRuby: use oracle database
Seems it it is not possible, otherwise please let us know. Here the shortest/simplest example i could produce using jdbc require 'java' #source: http://www.oracle.com/technetwork/articles/dsl/jruby-oracle11g-330825.html java_import 'oracle.jdbc.OracleDriver' java_import 'java.sql.DriverManager' begin oradriver = OracleDriver.new DriverManager.registerDriver oradriver user = 'xxx' passwd = 'xxx' url = 'jdbc:oracle:thin:@xxxxxx:9999:xxxx' conn = DriverManager.get_connection url, user, passwd select_sql = "select * from resources" select_stmt = conn.create_statement rset = select_stmt.execute_query select_sql while (rset.next) puts " resource [#{rset.getInt(1)}, #{rset.getString(2)}]" end rescue puts "Failed executing Oracle demo from JRuby ", $!, " " ensure

Categories : Oracle

How does one debug jRuby using eclipse?
Download the Eclipse Dynamic Languages Toolkit - Ruby Development Tools. Import your ruby on rails project. Check that your Gemfile references: gem 'ruby-debug' Then go to windows -> preferences, and do two things: setting the eclipse ruby interpreter to: c:jrubyinjruby.bat setting the eclipse ruby debug engine so it's not the "fast debugger" but "ruby built-in debugger" Then in the run configuration, main tab, under "ruby script" the launch script is bin/rails, and in the arguments tab server --debugger. The interpreter tab should point to JRuby.bat Go to run -> run and give it about 30 seconds to load the JVM, the ruby environment, and hook everything in. Then check your http://localhost:3000/ To start debug execution then type debugger in the place you want to start the

Categories : Ruby On Rails

how do I run jruby in jenkins on ubuntu
reload bashrc or bash_profile to make sure rvm is getting loaded /bin/bash --login source ~/.bashrc source ~/.bash_profile rvm use jruby-1.7.4 my bashrc has this PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting bash_profile has this [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

Categories : Ubuntu

Using archive-tar-minitar with jRuby
SOLVED after installing: gem install archive-tar-minitar CONFIG: MS Windows 7 SP1, JRuby 1.7.4. Ruby Gems must be installed before they can be used. This is why the error occurred in the first place. For more information, visit the http://www.rubygems.org web site.

Categories : Ruby

Make G-WAN's Ruby to use JRuby
attempt to replace Ruby by JRuby This won't work as is because G-WAN is checking if the ruby runtime is available by invoking ruby and checking the program reply. We could add JRuby detection however. But the proper way to use Ruby might be its embedding interface in C (if there's any). If you are interested in such a solution then please drop us a line with the proper information (code sample would be great). That's the way we have implemented C, C++, D, Objective-C, C# and Java. Regarding the partial implementation of the G-WAN C API for Java and Scala, that happened for two reasons: many G-WAN functions will no longer be fast once wrapped in JNI (with the data conversions that come with it) very few Java or Scala developers are seeking to use high-performance replacements for

Categories : Ruby

jruby on rails and jar files
Apparently, you can do 3 things to run an external command: Kernel.system "command" %x[command] command So, in your case your Ruby code would probably be: `java -jar <name of jar>.jar` And it would work. It might be that you have to add the full path for Java here, but you might have to try that out yourself.

Categories : Java

RVM is not creating a gemset with jruby
you are using very old version of rvm that comes from ubuntu package and is broken, use this answer to fix it http://stackoverflow.com/a/9056395/497756

Categories : Ruby

jruby runtimes and tomcat
first of all there's a bit of confusion in the q - setting min/max runtime parameters will not prevent perm-gen errors ... you will likely need to increase memory a bit (depending on your application's footprint) as you're seeing those esp. if you're setting min/max values higher. secondly - it will sure throttle concurrency but not that much - think of it as mongrel (thin) cluster: concurrent requests handled >= the number of running instances a single runtime is blocked for the duration of a single request (does not depend at all on any session state), after the response is returned the runtime is returned to the pool and is ready to handle another requests. if a request comes in and there's no runtime in the pool it will try to wait for one to become available before returning a HTTP

Categories : Tomcat

Undefined method 'error' in JRuby
I haven't run on that kind of error before, but just to double-check .. have you used jruby specific gem for making a connection to databases: https://github.com/jruby/activerecord-jdbc-adapter If not, try using that instead the ones you have been using so far for "regular" ruby

Categories : Ruby On Rails

New rails project with MRI Ruby2 or JRuby 1?
Honestly, if you are new to Ruby and Rails, just stick with the defaults - MRI in this case. Ruby enjoy several great implementations (MRI, JRuby, Rubinius, ...) that will run your web application without any problem. Starts with MRI, you can always decide to change later if needed. You will be in a much better position to judge what is the best Ruby implementation and server when the work on your application will have started - more proficient on the plateform, and more aware of your specific challenges (not every application is that dependent on multi threading performance). Enjoy the road!

Categories : Ruby On Rails

JRuby / basic PostgreSQL connection
The docs suggest something along the lines of: # connection setup ActiveRecord::Base.establish_connection( :adapter => 'jdbc', :driver => 'org.postgresql.Driver', :url => 'jdbc:postgresql:sample_db;create=true' ) Or ActiveRecord::Base.establish_connection( adapter: 'postgresql', database: 'db/my-database' ) This is assuming you're using JDBC and the appropriate configuration. For this, I suggest taking a look at Postgres' documentation. Sample provided over there is written in Java: String url = "jdbc:postgresql://localhost/test"; Properties props = new Properties(); props.setProperty("user","fred"); props.setProperty("password","secret"); props.setProperty("ssl","true"); Connection conn = DriverManager.getConnection(url, props); String url = "jdbc:postgresql://

Categories : Ruby On Rails

Can I use activerecord-nulldb-adapter in JRuby
Yes, you can use activerecord-nulldb-adapter because it is implemented in pure Ruby and therefore will run under JRuby: https://github.com/nulldb/nulldb

Categories : Ruby

adding to a jruby class's getDeclaredMethods()
Maybe this bug is currently stopping you? http://jira.codehaus.org/browse/JRUBY-6105 There are two ways to create java classes https://github.com/jruby/jruby/wiki/GeneratingJavaClasses I've tried both ways and am getting nil as described in the bug. This question is similar Can I define a Java subclass in ruby, then instantiate it in Java?

Categories : Java

JRuby on Rails and Solr indexing
Solved it on my own. The WHERE clause wants to call: WHERE (`curr_description_f`.`id` >= 0) Basically, because of the malformed sqldump, my database had a string id for primary key, and the key wasn't even assigned to my model. That's why it was empty. So I re-created the tables with INT as a primary key, and then added an additional line to my model: self.primary_key = "id"

Categories : Mysql

Using redis in jruby threaded setup
The problem here is, that the redis client locks exclusively (you can verify that by measuring the time that it takes for a command for 1,2,3 etc.. threads, it will most probably be linear). There are two solutions here: create a new client for every thread (be careful it will leave you with a lot of open files and for a long running process, it will kill your machine) implement a connection pool use this gem as your connection pool (I haven't tested it yet)

Categories : Ruby

update to jruby-1.7.4 with loading problems
After trying to load gems individually via jirb, I soon found out, that only my gems did not load, and always with the ArrayIndexOutOfBoundsException. My gems included java *.class files compiled with rubyc. This was the reason. I rebuild them with *.rb files and everything works. Does anyone know why *.class files inside a gem are not loaded using jruby-1.7.4? also check this answer require self made gem in jruby fails after update to jruby-1.7.13

Categories : Java

Jruby IRB up arrow(history) not working
try: $ rvm use 2.0.0 $ find $MY_RUBY_HOME -name readline* /home/mpapis/.rvm/rubies/ruby-2.0.0-p0/lib64/ruby/2.0.0/x86_64-linux/readline.so $ ldd /home/mpapis/.rvm/rubies/ruby-2.0.0-p0/lib64/ruby/2.0.0/x86_64-linux/readline.so linux-vdso.so.1 (0x00007fff7e576000) libruby.so.2.0 => /home/mpapis/.rvm/rubies/ruby-2.0.0-p0/lib64/libruby.so.2.0 (0x00007fc41de05000) libreadline.so.6 => /lib64/libreadline.so.6 (0x00007fc41db96000) libncurses.so.5 => /lib64/libncurses.so.5 (0x00007fc41d970000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc41d754000) librt.so.1 => /lib64/librt.so.1 (0x00007fc41d54b000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fc41d347000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fc41d10b000) libm.so.6 => /lib64/l

Categories : Ruby

is there any scriptella jruby script sample/example?
Try setting the language property to jruby and make sure the required jars are available on classpath. You can either copy them to <scriptella_home>/lib directory or include in the connection declaration: <connection id="script" driver="script" classpath="path/to/jar:path/to/jar2"> language=jruby </connection>

Categories : Misc

jruby cannot load java class from jar
It seems that wrapping your Java class in a module supressed a more detailed error message. I was able to debug by making this call instead: client = Java::ComAmazonawsMws::MarketplaceWebServiceClient.new It seems you're missing some dependencies. Try adding these to the top: require 'third-party/httpcore-4.2/httpcore-4.2.jar' require 'third-party/httpclient-4.2/httpclient-4.2.jar' require 'third-party/commons-httpclient-3.0.1/commons-httpclient-3.0.1.jar' require 'third-party/commons-logging-1.1/commons-logging-1.1.jar'

Categories : Java

ActiveRecord and jRuby threads/fibers (Rails 4)
If you are deploying your app on Heroku (which I am assuming here, as you are using Heroku Postgres) then your database.yml file will be overwritten when you deploy your app. Heroku injects a new database.yml that is designed to parse the DATABASE_URL environment variable, so none of your settings would apply in production. There is an article about this in the Heroku Devcenter. Essentially you need to update the active record configuration and re-establish the connection after your app has loaded. A nice benefit of that approach is that you can easily change your connection pool without doing an additional deploy, you simply run: heroku config:add DB_POOL=24 And the app gets restarted with the new pool level.

Categories : Ruby On Rails

Unicode issue with strftime on Windows jRuby
It's a readline (shipped with JRuby) issue, a simple fix is start irb with option --noreadline (Or add IRB.conf[:USE_READLINE] = false in your ~/.irbrc). C:ConEmu>jirb irb(main):001:0> format = '%Y年%b%d日 %H:%M' => "%Y?b%d?%H:%M" # Readline cannot handle GBK input here irb(main):002:0> exit C:ConEmu>jirb --noreadline irb(main):001:0> format = '%Y年%b%d日 %H:%M' => "%Y年%b%d日 %H:%M" # without Readline, it works irb(main):002:0> format.encoding => #<Encoding:GBK> irb(main):003:0> Time.now.strftime(format) => "2013??Jun20?? 23:20" # strftime cannot process GBK input here strftime won't function well with a GBK encoded string. So encode the parameter to UTF-8 before passing it to strftime. BTW, it's very st

Categories : Ruby On Rails

Finding current Thread Id with JRuby on Rails
for this purpose, you will find following methods useful: Thread.current to gets the of thread which is currently being executed #<Thread:0x8301ef4 run> Thread.list to get an array of Thread objects for all threads that are either runnable or stopped. [ [0] #<Thread:0x8301ef4 run> ] Hope it helps

Categories : Ruby On Rails

How to test and document JRuby compatibility, for a gem with some C exts
It looks like you can pass it in with the JRUBY_OPTS environment variable, which you would do by adding this to your .travis.yml file: env: global: - "JRUBY_OPTS=-Xcext.enabled=true"

Categories : Ruby

Executing initialization code before java_import in JRuby?
Methods get called when they get … well … called. If you call initialize before you call java_import it will execute first, if you call it after java_import it will execute after java_import. If you want to call initialize before you call java_import, you need to call initialize before you call java_import.

Categories : Ruby

jruby on rails retrive attributes in hash
I don't know how can you have such attributes "MODEL" or "MODELNAME". Firstly capitalized attrs are not allowed as they represent constant. Secondly "Model" is a reserved word of course, you can't use this word freely. Thirdly the model name "Cars" in not a convention. Model names are supposed to be singular. Anyway, if your model name is "Car" and attribute name is "model_name" which is legal, you can get the value from hash by a symbol Car.first[:model_name]

Categories : Ruby On Rails

Why is memory never released in my Tomcat JRuby application?
This smells a lot like memory leak. Not a pretty sight. If there is not a lot of code, first check by eye, that you are closing connections and streams and all objects that have method close. If this is problem showed up recently, take a look at the code last modified. Other thing i would try is a code inspection with some tool. Maybe write some tests to speed up the leak (like generating requests), you can then try excluding code from application, until you find area that is causing leak. I don't recommend you inspecting objects in memory since it is a slow and painful process.

Categories : Java

What are the differences "under the hood" between running from jruby and a warbled jar?
Maybe you don't have the libgdx library inside the jar, try this, execute the jar with: java -cp gdx.jar -jar <filename>.jar Assuming that the libgdx.jar is in the same folder. It's simply a classpath problem probably

Categories : Java

Using Puma and JRuby without threadsafe Rails application
Yes you can "The JRuby runtime itself is considered to be threadsafe. From Java, you can use a single runtime safely across threads, provided the code in those threads does not do thread-unsafe. Thread-safety does not mean your code will always run correctly; you will still often need to ensure threads don't step on each others' modifications."

Categories : Ruby On Rails

Is it possible to convert an anonymous class from Java to JRuby?
Your issue seems to be that VacmMIB constructor takes array of MOServer as an argument and you're passing an instance of MOServer. Try this: _server = Agent::MOServer.new { self.server } # your code # self.vacmMIB = Agent::MO::SNMP::VacmMIB.new(_server) # updated code self.vacmMIB = Agent::MO::SNMP::VacmMIB.new([_server])

Categories : Java

Activesupport error while installing rails in jruby
Are you able to update your JRuby version? Alternatively, try set this shell variable: export JRUBY_OPTS=--1.9 ...then re-execute your gem install rails command.

Categories : Ruby On Rails

Making Imports work with vlcj and JRuby on OSX
I found the solution to the problem : On MacOSX I need NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(),"/Applications/VLC .app/Contents/MacOS/lib");to be before the import statement java_import 'uk.co.caprica.vlcj.binding.LibVlc' for JNA to find the native libraries.

Categories : Misc

Executing a batch file to create a test file with xp_cmdshell - differentt results
If you test the commands directly at a command prompt, they work. The cd statement produces a text file containing the name of the current directory; the type statement produces a zero-byte file, but it does indeed produce a file. Most likely, xp_cmdshell is executing in a folder where the account it's running under has no write privileges, and you're not specifying another location for the file to be written. (The echo statement that works specifies a folder location for the text file, while your other two don't.) Change your batch file to: cd > C:development est est1.txt or type NUL > C:development est est1.txt If the echo statement works there when run via xp_cmdshell, you know it's writable by the NTAuthority account.

Categories : Sql Server

How to write the results of a batch file called in a Python script to a file
Why are you calling list2cmdline? This doesn't actually call the subprocess. Use subprocess.check_output instead: import os output = [] for _, _, files in os.walk(directory): for f in files: fullpath = os.path.join(directory, os.path.basename(f)) output.append(subprocess.check_output([fullpath])) print ' '.join(output)

Categories : Python

adding and opening an .xls or excel file to solution results to cannot find file
If you don't specify folder path it tries to get the file from the executable path. To use the file from your resources try this: xlsWorkBook = xlsApp.Workbooks.Open(My.Resources.MyFileName) Or use the proper local path where your file is located: IO.Path.GetFullPath(Application.StartupPath & "....Resources") & "database.xls"

Categories : Vb.Net



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.