Enforce JRuby to use gems inside the JRuby complete and ignore the local gem repository

Most of us are aware that Gems can be bundled as part of JRuby Complete, and Jruby will automatically load these gems from the jruby-complete.jar happily.

But do you know that, if you had a local gem repository set, jruby will ALWAYS attempt load the gems ONLY from your local gem repository? And ignore the gems bundled inside the jruby-complete.jar?

Well, we are aware of that, but it was quite annoying when we find that some code that worked happily in our development environment does not work in production, bcos the codes were referring to some gems that were available only in our development environment.

To ensure JRuby completes ignores our local gem repository, we used to add the following line in our deployment scripts before launching JRuby.

unset GEM_HOME

We are trying to understand the principle behind using the local gem repository even though certain gems are bundled inside the Jruby Complete.

Some thoughts on how Jruby should choose the gem repository
1. Whenever jruby is launched from the jar file with embedded ruby home, then always assume to use the embedded gem home and ignore the local gem repository?

OR

2. If atleast one gem is bundled in jruby-complete, then can jruby assume the developer wants to use the particular gem in his application and hence ignore the local gem repo and set the gem repo as the embedded gems location inside jar?

We are unable to come to a conclusion on what is the sane approach to handle the situation.

For now, we have patched jruby to go thru first approach. This way, I am completely sure that when jruby is launched from jar, my local gem repository is not coming in the way. And I dont have to remember to “unset GEM_HOME” in all my deployment scripts to tell Jruby to look for gems embedded in the jar file.

Hope this may be of some help for people who have had faced this issue.

JOpenSSL gem inside JRuby Complete

We had faced quite a lot of issues trying to embed JOpenSSL inside jruby-complete.jar.

We used to get an error “Uninitialized constant OpenSSL::Digest::OPENSSL_VERSION_NUMBER” with the following stack trace :

NameError: uninitialized constant OpenSSL::Digest::OPENSSL_VERSION_NUMBER
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl/cipher.rb:28:in `const_missing’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl/digest.rb:23
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl/digest.rb:31:in `require’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl.rb:24
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/jruby-openssl-0.6/lib/openssl.rb:31:in `require’
from file:/home/msuser1/jruby-complete-1.3.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’

You can find Charles’ explanation here

What we did is the following :

1. Add the Jruby-openssl gem inside the jruby-complete.jar bundle like adding any other gems(rspec, rake etc.)
2. Extract the JRuby Complete Jar in a fresh folder
3. In addition to this, extract the contents of jopenssl.jar directly under the root folder. (jopenssl.jar is located inside the lib folder of the jruby-openssl gem).
4. Re-create the jruby-complete.jar from this exploded folder.

Thats about it, you are all set to use openssl inside jruby without any issue.

Please note, at the time of writing this post, I was using JRuby 1.3.1 and Jopenssl 0.6.

Another iPhone App on the pipeline – Tarabalam

After developing an iPhone app called Panchangam Lite and seeing its success rate in terms of increasing number of downloads day after day and receiving positive feedback for the app, we were motivated quite a lot and it made us realize that there are lots of people around the world looking for such cool and useful tools in their iPhone…And we thought lets develop another app for such people in the similar lines…hence an app named “Perfect Day (Tarabalam)” is born.  The app should be available in AppStore very soon 🙂

Ok, then here goes some notes about “What is Tarabalam ?” and why and how should it be used?

http://picasaweb.google.com/s/c/bin/slideshow.swf

Importance of Muhurtha (Quoted from the well known astrologer BV Raman)

The value of Time is inestimable. All objects in nature are produced in Time, developed in Time and destroyed in Time. The truth of these statements requires no further proof. It stands unchallenged.

Each moment has got its own potency and as Carl Jung says “whatever is born or done this moment of time has the qualities of this moment of time”. Hence the moment of birth or the moment at which we elect to do an important act is not certainly an insignificant epoch. Cosmic radiations pouring at the moment on the earth from outer space and coming from various stars and planets act on our brain cells which take up these cosmic radiations which are transformed into vital electricity. It must be noted that in all undertakings invisible energies are set in motion by our words, deeds, thoughts and of course by our actions. You may call these invisible forces as electric, ethereal or electro-magnetic or cosmic radiations. As man himself is an electrical body discharging different kinds of electrical energies, his success and failure are simply matters of attraction and repulsion between himself and the objects with which he has to deal in his day-to-day activities.

Muhurtha could therefore be defined as that precious moment when the vibrations radiated by man are altered to a specific wavelength capable of entering resonance with the radiations of the same vibratory rate coming from other planets and stars.

What is Tarabalam?

Various strengths are checked for muhurtham. Tarabalam, Chandrabalam, Gurubalam, Suryabalam, Lagnam shuddhi, etc… As outlined in following mantra. When we worship lakshmipati sri narayana, he will make everything right. He is tithi, vaara, nakshatra, yoga, karana. Hence, worshipping him will make everything right, remove all dosha.

तदेव लग्नं सुदिनं तदेव ताराबलं चंद्रबलं तदेव। विद्या बलं दैवबलं तदेव लक्ष्मीपतेः तेंघ्रिऽयुगं स्मरामि॥

tadeva lagnaṁ sudinaṁ tadeva tārābalaṁ caṁdrabalaṁ tadeva | vidyā balaṁ daivabalaṁ tadeva lakṣmīpateḥ teṁghri’yugaṁ smarāmi

Tarabalam is a strength provided by stars to your Janma / Birth star. Nakshatra/Star of moon at the time of your birth is known as Birth star. Moon’s daily star / Nakshatra position needs to be favourable for casting any muhurtha. Moon takes roughly 27 days to circle around earth and passes through 27 nakshatras. Daily motion of moon from your janma nakshatra decides this strength.

What does this mobile app do?

In order to increase the chances of success in any endeavor, this mobile app helps the user to pick days / times to perform the endeavor when Tarabalam is very strong. It calculates Tarabalam for 400 cities around the world for the year 2010. The timings are daylight adjusted where-ever applicable. You can also keep a list of your family / friends with their birth star and easily select Tarabalam for the person with just a click of the button.

Tarabalam is available for year 2010.