1 / 51

Java, .N ET , Ruby and PHP integration

33rd Degree Conference Kraków, 7 April , 2011. Java, .N ET , Ruby and PHP integration. Matthias Hryniszak. The following presentation is intended for informational purposes only .

meryl
Download Presentation

Java, .N ET , Ruby and PHP integration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 33rd DegreeConference Kraków, 7 April, 2011 Java, .NET, Ruby and PHP integration Matthias Hryniszak

  2. The following presentation is intended for informational purposes only. There’s no part of it that you should consider either a guideline, viable option or production-ready set of instructions that could solve your problem If you use any concepts of what you see here it is entirely up to you to make sure it works for you.

  3. The story so far…

  4. X86 asm

  5. section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point movedx,len ;message length movecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'Hello, world!',0xa ;our dear string lenequ $ - msg ;length of our dear string

  6. C/C++

  7. #include <stdio.h> • #include <stdlib.h> intmain() { println("Hello, world!"); } • #include <iostream> • int main(){ • std::cout << "Hello World!" << std::endl; • }

  8. JEE

  9. │ pom.xml • │ • └───src • ├───main • │ ├───java • │ │└───com • │ │└───aplaline • │ │└───example • │ ││MyApplicationModule.java • │ ││ServletConfig.java • │ ││ • │ │├───components • │ ││TextLabel.java • │ ││ • │ │└───views • │ │FrontView.java • │ │RootView.java • │ │ • │ ├───resources • │ │└───com • │ │└───aplaline • │ │└───example • │ │├───components • │ ││TextLabel.xsl • │ ││ • │ │└───views • │ │FrontView.xsl • │ │RootView.xsl • │ │ • │ └───webapp • │ │main.css • │ │ • │ ├───gfx • │ │pageheader.png • │ │ • │ ├───scripts • │ │contextfw.js • │ │jquery.js • │ │json.js • │ │ • │ └───WEB-INF • │ web.xml • │ • └───test • └───java • └───com • └───aplaline • └───example • WebStart.java

  10. Ruby

  11. puts 'Hello world'

  12. PHP

  13. <?php echo "Hello, World!"; ?>

  14. C#.NET

  15. using System; • class Pogram { • public staticvoidMain() { • Console.WriteLine("Hello, world!"); • } • }

  16. AgendaTheno-brainers • PHP – thedynamiclanguage for masses • Whywouldyouevencare? • How to integratewith PHP code • Ruby – thenewwave • What’s Ruby reallygoodat? • How to integratewith Ruby code 整合

  17. AgendaTheevil, but coolside of life • .NET– theeviltwinfrom Microsoft • Whywouldyouevencare? • Thelameside of integration… • Howcoolkids do it? 整合

  18. TRY THIS BEFORE YOU USE IT!

  19. Howabout… Java integration 整合

  20. Wiki in 2 minutes? 整合

  21. Wiki in 2 minutes! MediaWiki 整合

  22. Blogin 2 minutes? 整合

  23. Blogin 2 minutes! Wordpress 整合

  24. Forum in 2 minutes? 整合

  25. Forum in 2 minutes! PhpBB 整合

  26. TRY THIS BEFORE YOU USE IT!

  27. Ruby as a scriptinglanguageJSR 223 ScriptEngineManagersem = newScriptEngineManager(); ScriptEnginese = sem.getEngineByExtension("rb"); InputStreamis = ClassLoader.getSystemResourceAsStream("hello.rb"); InputStreamReaderscript = newInputStreamReader(is); try { Objectresult = se.eval(script); System.out.println("Result: " + result); } catch (Exception e) { System.out.println( "Errorwhileexecutingscript\n" + e.getMessage() ); } 整合

  28. Ruby as a scriptinglanguageJSR 223 require'java' Calculator = com.aplaline.example.Calculator calc = Calculator.new calc.add(2.0,3.0) 整合

  29. Ruby as a scriptinglanguageJSR 223 require'java' Calculator = com.aplaline.example.Calculator calc = Calculator.new calc.add(2.0,3.0) 整合

  30. Ruby as a language for testsJtestR - regular class HashMapTests < Test::Unit::TestCase def setup @map = java.util.HashMap.new end def test_that_map_is_empty assert @map.isEmpty end end 整合

  31. Ruby as a language for testsJtestR - RSpec import java.util.HashMap describe "An empty", HashMap do before :each do @hash_map = HashMap.new end it "should be able to add an entry to it" do @hash_map.put "foo", "bar" @hash_map.get("foo").should == "bar" end end 整合

  32. Don’t shoot the messenger

  33. Whyevenbother? • Learnfromother’smistakes • Becomeawarethat Java is not theonlychoice • Make sureyouunderstandtherisksinvolved • To haveplenty of fun! 整合

  34. Howwouldyouintegratewithit?Theold-fasionway… 整合

  35. Howwouldyouintegratewithit?Theold-fasionway… 整合

  36. Howwouldyouintegratewithit?TheIKVM-way IKVM.NET 整合

  37. What’sinthebox? • ikvmc.exe • thebinarycompiler • jar-to-dll/execonverter • ikvm.exe • the JVM implementation on .NET • ikvmstub.exe • dll-to-jarconverter • OpenJDKinassembly form 整合

  38. Java on .NET ??? Demo Groovy + OSGi 整合

  39. Whatruns on IKVM? Eclipse 整合

  40. Whatruns on IKVM? Apache Tomcat 整合

More Related