My goals have been:
- focusing on several project areas, where you can use jruby successfully
- share the experience that I made using ruby in the last years
- proove that things can be done easier as they are done in typical java projects
My goals have been:
- focusing on several project areas, where you can use jruby successfully
- share the experience that I made using ruby in the last years
- proove that things can be done easier as they are done in typical java projects
Finally Java SE 7 is GA and you can start using it. This talk will cover the most important new features of the language and the virtual machine. It will also cover some features that did not make it in to the SE 7 release. Finally we will discuss current state of Java as an ecosystem and my analysis and hopes for the future.
QueryPath provides a jQuery-like tool in PHP. Use it to work with local files, or with remote web services. This presentation illustrates how QueryPath can be used to build elaborate multi-source mash-ups in Drupal.
Explains how to make use of ruby in java-based work environments. There are some hints at .NET equivalents along the way.
This is part 3 of a trilogy of Star Wars-themed ruby talks given at Protegra's SDEC 2011 in Winnipeg, Canada.
Presented at BJUG, 6/12/2012 by Roger Brinkley
This talk is on 55 new features in Java 7 you (probably) didn't hear about in an ignite format of one per minute. No stopping, no going back....Questions, sure but only if time remains (otherwise save for later).
This talk provides a number of step-by-step examples that illustrate different ways in which Rails applications can interact effectively with third-party Java libraries. The presentation shows how developers can leverage JRuby to augment Rails applications with the mature, third-party libraries that are widely available in the Java world.
* История JRuby;
* Платформа JVM и ее возможности;
* Почему стоит попробовать JRuby;
* Как мы в Хот Спот используем JRuby для разработки;
* Сравнение с другими JVM языками.
Finally Java SE 7 is GA and you can start using it. This talk will cover the most important new features of the language and the virtual machine. It will also cover some features that did not make it in to the SE 7 release. Finally we will discuss current state of Java as an ecosystem and my analysis and hopes for the future.
QueryPath provides a jQuery-like tool in PHP. Use it to work with local files, or with remote web services. This presentation illustrates how QueryPath can be used to build elaborate multi-source mash-ups in Drupal.
Explains how to make use of ruby in java-based work environments. There are some hints at .NET equivalents along the way.
This is part 3 of a trilogy of Star Wars-themed ruby talks given at Protegra's SDEC 2011 in Winnipeg, Canada.
Presented at BJUG, 6/12/2012 by Roger Brinkley
This talk is on 55 new features in Java 7 you (probably) didn't hear about in an ignite format of one per minute. No stopping, no going back....Questions, sure but only if time remains (otherwise save for later).
This talk provides a number of step-by-step examples that illustrate different ways in which Rails applications can interact effectively with third-party Java libraries. The presentation shows how developers can leverage JRuby to augment Rails applications with the mature, third-party libraries that are widely available in the Java world.
* История JRuby;
* Платформа JVM и ее возможности;
* Почему стоит попробовать JRuby;
* Как мы в Хот Спот используем JRuby для разработки;
* Сравнение с другими JVM языками.
The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory AnalyzerVladimir Pavlov
Presentation given at Java2Days 2010 in Sofia, Bulgaria, about using Eclipse Memory Analyzer for troubleshooting JRuby memory and thread issues. Session abstract at http://2010.java2days.com/agenda/the-right-pill-for-jruby-memory-and-thread-issues-eclipse-memory-analyzer
1. Using Java from Ruby
with JRuby IRB
Hiro Asari
Engine Yard
Tuesday, June 14, 2011 1
2. Why JRuby?
• Interactive shell for looking around
(without writing lots of code)
• Testing frameworks
• Ruby on Rails
Tuesday, June 14, 2011 2
3. Assumptions
• JRuby 1.6.2 (or 1.7.0.dev)
• Java 6 (5 or later; 7 support in the works)
• Ruby 1.8
Tuesday, June 14, 2011 3
Ruby syntax will be introduced as we go along.
We do not use tricky syntax for this presentation
4. Starting IRB
jruby -S irb
http://jruby.org/tryjruby
Tuesday, June 14, 2011 4
'-S' tells jruby to look for a script thus named in certain locations (in predefined order) and
execute it. (of course, the usual semantics re: scripts hold here.)
"tryjruby" has some limitations w.r.t. Java integration (obviously)
5. Loading Java support
require 'java'
Tuesday, June 14, 2011 5
Like Java's "import"
6. Finding Java libraries
# shell
export CLASSPATH=…
jruby -J-cp <classpath> …
jruby -I lib …
# in ruby
$: << File.join(File.dirname(__FILE__),
'lib')
Tuesday, June 14, 2011 6
Java way, or Ruby way
$: is the global for load paths where Ruby looks for libraries
__FILE__ is a shorthand for "this file"
8. Importing Java class
Bazz = Java::foo.bar.Bazz
java_import 'foo.bar.Bazz'
java_import java.lang.System
Tuesday, June 14, 2011 8
Ruby Class names are separated by namespaces, which is delimited by double colons.
Java's built-in classes don't need to be referred to via a String
Ruby class names are constants, the name of which must start with a capital letter.
9. Referring to Java class
bazz = Java::foo.bar.Bazz.new
bazz = Bazz.new # Bazz is already imported
Tuesday, June 14, 2011 9
No parentheses are necessary for Ruby methods, unless ambiguous otherwise
10. Implementing Java interface
class Foo
include java.lang.Runnable
def run
puts "foo"
end
end
Tuesday, June 14, 2011 10
JRuby works hard to make this simpler, but you get the idea
11. Calling static methods
Bazz.method(arg1, arg2)
java.lang.System.currentTimeMillis
Tuesday, June 14, 2011 11
This is similar to calling Ruby's class methods
12. Accessing static fields
java.lang.System.out
java.util.logging.Level::INFO
Tuesday, June 14, 2011 12
Here, "." and "::" are interchangeable
13. Type conversion
object.to_java(foo.bar.Bazz)
"Hello, Richmond!".to_java
5.to_java(java.lang.Double)
Tuesday, June 14, 2011 13
For the most part, JRuby converts types for you behind the scenes, so you don’t need to
worry about this; but when you do, you can use this.
Cannot be used for casting to primitives. Sorry.
14. Invoking overloaded method
// you need a cast in Java…
java.lang.System.out.println((char)70)
java.lang.System.out.java_send :println,
[Java::char], 70
Tuesday, June 14, 2011 14
:println is an example of a Ruby symbol. It is a uniquely identifiable object within the Ruby
runtime. "abc" and "abc" maybe two different Strings, but :abc is always unique.
Notice how we specify the Java primitive "char"
15. Complex example with Akka
http://akka.io
“ Akka is the event-driven, the nextand
generation
platform for
scalable
fault-tolerant architectures on the JVM ”
Tuesday, June 14, 2011 15
16. Akka tutorial
Compute π using the Madhava-Leibniz series
Tuesday, June 14, 2011 16
http://akka.io/docs/akka/1.1.2/intro/getting-started-first-java.html
17. π
= 4(1-1/3+1/5-1/7+1/9-1/11+1/13+…)
= 4(1-1/3+1/5-1/7)
+ 4(1/9-1/11+1/13-1/15)
+ 4(1/17-1/19+1/21-1/23)
+…
Tuesday, June 14, 2011 17
http://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80
Does not converge very fast
18. How does it work?
Pi
Calculate
Work Work
Master PiRouter Worker
Result Result
Tuesday, June 14, 2011 18
Red: Actors
Green: Messages (POJO)
Akka actors invoke onReceive(Object) method when a message is sent. A router routes
messages between actors.
19. Akka tutorial
Code reading and demo
Java source: http://bit.ly/lTClmr
Ruby source: https://gist.github.com/1013227 (Without comments)
(See also) https://gist.github.com/1013217
Tuesday, June 14, 2011 19
See handout
24. RSpec
describe Game do
describe "#score" do
it "returns 0 for all gutter game" do
game = Game.new
20.times { game.roll(0) }
game.score.should == 0
end
end
end
Tuesday, June 14, 2011 24
http://relishapp.com/rspec
25. Cucumber
# language: en
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario Outline: Add two numbers
Given I have entered <input_1> into the calculator
And I have entered <input_2> into the calculator
When I press <button>
Then the result should be <output> on the screen
Examples:
| input_1 | input_2 | button | output |
| 20 | 30 | add | 50 |
| 2 | 5 | add | 7 |
| 0 | 40 | add | 40 |
Tuesday, June 14, 2011 25
http://cukes.info
https://github.com/cucumber/cucumber/blob/master/examples/i18n/en/features/
addition.feature
26. IDE
• RubyMine
• NetBeans (separate Ruby plugin for 7.0)
• Eclipse
Tuesday, June 14, 2011 26
27. Other stuff
• Ant integration
• warbler (generate WAR files)
• Ruboto (JRuby on Android)
Tuesday, June 14, 2011 27
28. Sponsored plug
• JRuby on Rails hosting now available on
Engine Yard's AppCloud
Tuesday, June 14, 2011 28
29. JRubyConf 2011
Washington, DC
August 3-5
http://jrubyconf.com
Tuesday, June 14, 2011 29