Skip to content

Instantly share code, notes, and snippets.

View donv's full-sized avatar

Uwe Kubosch donv

View GitHub Profile
@donv
donv / MethodsExample.java
Created July 7, 2012 00:34
Find Ruby method from Java side
import org.jruby.embed.ScriptingContainer;
import java.util.Arrays;
class MethodsExample {
public static void main(String[] args) {
System.out.println("Hello world!");
ScriptingContainer sc = new ScriptingContainer();
MethodsExample me = new MethodsExample();
java.util.List<String> methods = (java.util.List<String>)sc.callMethod(me, "methods");
@donv
donv / ant output
Created August 2, 2012 11:45
Failure for "ant test"
[java] 1) nonblocking IO blocking behavior: JRUBY-5122 should not block for write
[java] Failure/Error: value.should == 3
[java] expected: 3
[java] got: 2 (using ==)
[java] # ./spec/regression/JRUBY-5122_nonblocking_io_spec.rb:244:in `(root)'
[java] # ./spec/regression/JRUBY-5122_nonblocking_io_spec.rb:218:in `(root)'
[java]
@donv
donv / adb logcat output
Created November 12, 2012 00:19
DexOpt failure with new dx.jar and new JRuby 1.7.1.dev
D/installd( 37): DexInv: --- BEGIN '/data/app/org.ruboto.core-1.apk' ---
E/dalvikvm( 513): Out-of-order method_idx: 0xffff then 0x0
E/dalvikvm( 513): Trouble with item 3591 @ offset 0xa62e40
E/dalvikvm( 513): Swap of section type 2006 failed
E/dalvikvm( 513): ERROR: Byte swap + verify failed
E/dalvikvm( 513): Optimization failed
W/installd( 37): DexInv: --- END '/data/app/org.ruboto.core-1.apk' --- status=0xff00, process failed
@donv
donv / gist:4237753
Created December 8, 2012 00:18
Build ruboto-irb
macbeth:ruboto-irb uwe$ rake install
(in /Users/uwe/workspace/jruby/ruboto-irb)
ant debug
Buildfile: /Users/uwe/workspace/jruby/ruboto-irb/build.xml
-set-mode-check:
-set-debug-files:
-check-env:
@donv
donv / gist:4770295
Created February 12, 2013 14:41
Ruboto Android POST example
java_import 'android.net.http.AndroidHttpClient'
java_import 'android.util.Log'
java_import 'org.apache.http.client.entity.UrlEncodedFormEntity'
java_import 'org.apache.http.client.methods.HttpPost'
java_import 'org.apache.http.message.BasicNameValuePair'
java_import 'org.apache.http.util.EntityUtils'
t = Thread.start do
begin
client = AndroidHttpClient.newInstance('MyClient')
@donv
donv / Java stack trace
Last active December 15, 2015 05:59
Java stack trace of blocked Ruby thread.
java.lang.Object.wait(Native Method)
java.lang.Thread.parkFor(Thread.java:1231)
sun.misc.Unsafe.park(Unsafe.java:323)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:813)
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireInterruptibly(AbstractQueuedSynchronizer.java:873)
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1200)
java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:311)
org.jruby.RubyThread.lockInterruptibly(RubyThread.java:1277)
org.jruby.ext.thread.Mutex.lock(Mutex.java:91)
@donv
donv / gist:5557091
Created May 10, 2013 20:17
JRuby on windows weirdness
Microsoft Windows [Versjon 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Med enerett.
C:\Windows\system32>where java
C:\Windows\System32\java.exe
C:\Windows\system32>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
@donv
donv / gist:6842581
Created October 5, 2013 15:54
Stack trace when running https://github.com/ruboto/ruboto/wiki/Tutorial:-fragments Possibly missing a reference to the fragment class.
I/System.out(13941): RubotoActivity onCreate(): org.ruboto.example.fragments.FragmentsActivity, finishing: false
I/System.out(13941): Exception creating activity: Binary XML file line #3: Error inflating class fragment
I/System.out(13941): android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
I/System.out(13941): android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
I/System.out(13941): android.view.LayoutInflater.inflate(LayoutInflater.java:489)
I/System.out(13941): android.view.LayoutInflater.inflate(LayoutInflater.java:396)
I/System.out(13941): android.view.LayoutInflater.inflate(LayoutInflater.java:352)
I/System.out(13941): com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
I/System.out(13941): android.app.Activity.setContentView(Activity.java:1835)
I/System.out(13941): java.lang.reflect.Method.invokeNative(Native Method)
@donv
donv / gist:8234480
Created January 3, 2014 07:59
Problem installing JRuby using RVM 1.25.13
Last login: Fri Jan 3 08:30:54 on ttys000
You have mail.
macbeth:~ uwe$ rvm --version
rvm 1.25.13 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
macbeth:~ uwe$ rvm install jruby-1.7.8
Searching for binary rubies, this might take some time.
Found remote file http://jruby.org.s3.amazonaws.com/downloads/1.7.8/jruby-bin-1.7.8.tar.gz
Checking requirements for osx.
@donv
donv / gist:8283063
Created January 6, 2014 13:45
Stack trace running a Rails 3.2.16 app with /usr/java/default/bin/java -Xmx2G -Xss2048k -Djffi.boot.library.path=/usr/local/jruby-1.7.9/lib/jni -Djava.awt.headless=true -Dawt.toolkit=sun.awt.HToolkit -Xbootclasspath/a:/usr/local/jruby-1.7.9/lib/jruby.jar -classpath : -Djruby.home=/usr/local/jruby-1.7.9 -Djruby.lib=/usr/local/jruby-1.7.9/lib -Djr…
[INFO ] org.projectodd.wunderboss.web.WebComponent - Undertow listening on localhost:3010
[INFO ] org.projectodd.wunderboss.web.WebComponent - Started web context /
[ERROR] io.undertow.request - Blocking request failed HttpServerExchange{ GET /}
java.lang.UnsupportedOperationException: BUG: invoking UndefinedMethod.call; report at http://bugs.jruby.org
at org.jruby.internal.runtime.methods.UndefinedMethod.call(UndefinedMethod.java:59)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:210)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:206)
at org.projectodd.wunderboss.ruby.rack.RackHandler.handleRequest(RackHandler.java:46)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:139)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:638)