Roger's woze

May 31, 2011

java/java/mirah woe

Filed under: Uncategorized — rogerdpack @ 8:26 pm

Exception in thread “main” org.jruby.exceptions.RaiseException: (ArgumentError) Constructor invocation failed: tried to access method RubyFromJava.<init>()V from class org.jruby.proxy.RubyFromJava$Proxy0

 

meant “you tried to access a constructor of a java class that wasn’t public or wasn’t in the same package or something like that” (for me, scripting jruby, this meant “remove your initializer from the ruby class” or “make the parent class initializer protected access”

 

how to embed jruby in java app

Filed under: Uncategorized — rogerdpack @ 4:40 pm

https://github.com/jruby/jruby/wiki/RedBridge

java check/detect integer/int/long overflow/underflow

Filed under: Uncategorized — rogerdpack @ 4:34 pm

look in jruby’s RubyFixnum.java for “additionOverflowed” and “subtractionOverflowed

    private static boolean additionOverflowed(long original, long other, long result) {
        return (~(original ^ other) & (original ^ result) & SIGN_BIT) != 0;
    }

    private static boolean subtractionOverflowed(long original, long other, long result) {
        return (~(original ^ ~other) & (original ^ result) & SIGN_BIT) != 0;
    }

mirah woe

Filed under: Uncategorized — rogerdpack @ 3:38 pm

NativeException: java.lang.NumberFormatException: For input string: “20000000000000000000″

 

meant “that number is too big for even a double, so mirah can’t parse/use it…”

mirah woe

Filed under: Uncategorized — rogerdpack @ 3:20 pm

c:\dev\ruby\stevia\lib>C:\dev\ruby\downloads\jruby\bin\jruby C:\dev\ruby\downloads\jruby\bin\mirah reproInference Error:Cannot find static method fib(int) on Reprorepro:5: Cannot find static method fib(int) on Repro     fib(a – 1) + fib(a – 2)

 

meant “your method is recursive so it needs to have both types declared–inferring a return type from recursive is hard, wouldn’t you agree?”

ruby/jruby inline java/mirah/duby/scala

Filed under: Uncategorized — rogerdpack @ 2:38 pm

all of them are in this gem

https://github.com/jruby/java-inline

 

github git woe

Filed under: Uncategorized — rogerdpack @ 1:10 pm

ubuntu@ubuntu-VirtualBox:~/dev$ git clone https://rdp@github.com/rdp/mirah.git
Cloning into mirah…
Password:
error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none while accessing https://rdp@github.com/rdp/mirah.git/info/refs

fatal: HTTP request failed

meant do this:

ubuntu@ubuntu-VirtualBox:~/dev$ git config –global –add http.sslVerify false

ref:

http://codeblue.umich.edu/index/issues/5

“work around”

ruby woe

Filed under: Uncategorized — rogerdpack @ 11:27 am

C:/installs/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require’: no such file to load — zip/zipfilesystem (LoadError)

meant “you need to install the rubyzip gem first”

java spring beans woe

Filed under: Uncategorized — rogerdpack @ 9:32 am
            java.lang.RuntimeException: Error trying to access bean with name mungeParametersHandler

this meant “you declared your bean with type prototype, and for some reason spring has trouble instantiating it the first time–either use spring to enumerate all the types first, then it can be instantiated [for some bizarre reason], or change it to singleton [if said object is instance/thread safe I suppose...]

May 30, 2011

ruby override concatenation (less than less than << operator)

Filed under: Uncategorized — rogerdpack @ 1:22 pm

class A

def <<(something)

end

end

(NB that it *has* to receive a parameter–it’s an operator that has to take a parameter).

Older Posts »

Powered by WordPress