Rails 7 on Jruby 9.4.0.0

Step to do :

  1. Install Jruby
  2. run jruby -S gem install rails
  3. run jruby -S rails new App
  4. Step 3 will fail miserably related to bindex gem.
  5. Open Gemfile and comment out web-console gem.
  6. Go to your App folder and run jruby -S bundle install
  7. run jruby -S rails server
  8. Browse localhost:3000 to view rails welcome page.

MD5 hash on modern java

To get a similar php md5 or postgresql md5 function on java then try this code.

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Md5Util {

public static String byteArrayToHex(byte[] a) {
       StringBuilder sb = new StringBuilder(a.length * 2);
       for(byte b: a)
          sb.append(String.format("%02x", b));
       return sb.toString();
}

public static String Hash(String input) throws NoSuchAlgorithmException {

    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(input.getBytes());
    byte[] digest = md.digest();
    return byteArrayToHex(digest);
}

}