JRuby on Rails, Flying Saucer

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    JRuby on Rails, Flying Saucer - Presentation Transcript

    1. Who's this then? Alexander Malfait Enjoying Rails since 2007 Tallest employee at CAT Solutions
    2. Wait, didn't we hate Java? JVM is fast JVM is everywhere, corporate approved Tons of useful & widely used libraries Runs great on Windows
    3. Running Rails jruby -S gem install glassfish jruby -S glassfish -e production config.threadsafe! Works on other app servers (.war file)
    4. Hiding behind Apache <VirtualHost *:80> ServerName my.awesome.app.be RewriteEngine On ProxyPass / http://localhost:3000/ retry=0 ProxyPassReverse / http://localhost:3000/ ErrorDocument 503 "<b>Come back in 10 seconds</b>" </VirtualHost> http://blog.headius.com/2009/04/apache-jruby-rails-glassfish-easy.html
    5. Talking to Java Just create java objects like Ruby objects Extend Java classes in Ruby Require jars from Ruby without mucking about with the JVM ClassPath
    6. Ruby Style Java java.lang.System.current_time_millis x.setSomething(var) => x.something = var button = javax.swing.JButton.new "Press me!" button.add_action_listener do |event| event.source.text = "You did it!" end
    7. Flying Saucer Renders XHTML/CSS3 to PDF (very well!) Written in Java Handles any reporting problem you can throw at it
    8. acts_as_flying_saucer Rails apps produce HTML You know HTML Report to PDF using HTML
    9. Cocktail Reporting class DrinksController < ApplicationController acts_as_flying_saucer def mojito @ingredients = [ "4.0 cl White Rum", "3.0 cl Fresh lime juice", "3 sprigs of Mint", "2 teaspoons Sugar", "Soda Water" ] render_pdf :send_file => { :filename => "tasty.pdf" } end end
    10. Cocktail Reporting <h1 style="color: green;">Mojito!</h1> <ul> <% @ingredients.each do |ingredient| %> <li><%=h ingredient %></li> <% end %> </ul> render_pdf
    11. I want my mojito NOW! Rendering drinks/mojito Completed in 16ms ~62 mojitos/second
    12. Larger documents Rendering the holy bible 4.5MB of HTML Resulting PDF: 1134 pages Completed in 22500ms
    13. Real Example
    14. Typical Reporting Problems Repeating headers / footers Paginating/nesting tables Lots of data Maintaining uniform reporting style All covered by the flying saucer!
    15. Script anything! JFreeChart: powerful charting Apache POI: read & write Excel files JODConvertor: convert (almost) anything to anything using OpenOffice.org Swing Hundreds more...
    16. References http://github.com/alexandermalfait/acts_as_flying_saucer http://bosmeeuw.wordpress.com/ http://www.catsolutions.be/

    + alexandermalfaitalexandermalfait, 1 month ago

    custom

    115 views, 0 favs, 0 embeds more stats

    A brief introduction to JRuby and JRuby on Rails, a more

    More info about this document

    CC Attribution License

    Go to text version

    • Total Views 115
      • 115 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 1
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories