GT.M interface to Ruby
The Performance of M
combined with
the Flexibility of Ruby
September 18 2013
Contents
1.
2.
3.
4.
5.
6.
Who did it
What is Ruby
Why a new Language
Teaching the Next Generation
GT.M from Ruby
Globals from Ruby
Who did it ?
Who did it ?
Rob Tweed
Luis Ibanez
What is it ?
M Language
M Database
What is it ?
Ruby
M Database
What is Ruby ?
Ruby
Interpreter
Compiler
Ruby
Very Large
Community
Large Number
of Packages
Ruby
Ruby
There is a Ruby Gem for that…
Why a new
language ?
What is Spoken ?
http://www.ohloh.net/languages/compare
41,642
Open Source Ruby Projects
Significant Project: Cypress
Teaching the
Next Generation
Teaching M Language
http://www.opensourcesoftwarepractice.org/M-Tutorial/
https://github.com/OSEHR/M-Tutorial
Teaching M Language
http://opensource.com/health/12/2/join-m-revolution
Teaching M Language
http://rpi.edu/about/index.html
Teaching M Language
http://www.albany.edu/cci
Teaching M Language
http://www.osehra.org/blog/teaching-m-databaseand-m-language-suny-albany-spring-2013-part-i
Teaching M Language
MUMPS Exposure Rate
30
28
97 110 81
Fall
2011
Spring
2012
Fall
2012
Spring
2013
Fall
2013
Teaching M Language
MUMPS Retention Rate
Classes
Internships
Jobs
Plan B
Ruby
54,922
Developers
M Database
NoSQL
https://www.ohloh.net/languages/ruby
Plan B
https://www.ohloh.net/languages/ruby
Plan B
327 Million
Lines of Code
54,922
Developers
41 Thousand
Projects
Training
https://www.ohloh.net/languages/ruby
Plan B
Google:
“Ruby Tutorial”
http://www.ohloh.net/languages/ruby
Plan B
GT.M from Ruby
GT.M from Ruby
Ruby Binary Package
SWIG Wrapping
C++ Wrapper
C - API
GT.M
GT.M – C API
http://tinco.pair.com/bhaskar/gtm/doc/books/pg/UNIX_manual/ch11s05.html
Code, Code, Code !
Talk is Cheap,
Show me the Code !
Linus Torvalds
Technical Journal Article
http://code.osehra.org/journal/browse/publication/28
gtm-bindings
https://github.com/OSEHRA-Sandbox/gtm-bindings
Tests / Examples
https://github.com/OSEHRA-Sandbox/gtm-bindings/tree/master/Testing
Example 01
How to Install
First install GT.M
apt-get install gtm
How to Install
Install gtm ruby package:
sudo gem install gtm
gtm: Ruby Gem
Post-Installation
http://www.osehra.org/blog/gtm-binding-ruby
Post-Install
export GTMCI=
/home/ibanez/src/m.js/Source/gtm_access.ci
The full path to gtm_access.ci
Post-Install
cp
_gtmaccess.m file
to Routines dir
It might be at
/home/ibanez/src/gtmbindings/Source
Post-Install
Add libgtmshr.so DIR
to LD_LIBRARY_PATH
Otherwise it must be installed in
/usr/lib/fis-gtm/V6.0000/libgtmshr.so
Example 02 – Set Global
Example 03 – Get Global
Example 04 – Kill global
Example 05 – Order
Example 06 – Query
Example 07 – Execute
Example 08 – Lock
Example 09 – Execute more
Example 10 – Fibonacci
Example 11 – Fibonacci
Example 11 – Fibonacci
Globals from Ruby
The Future:
Catching up with Node.js
Globals
Ruby Hash
Dictionary
Language Integration
What we say to Databases…
Blah, blah,
blah;
Blah;
Blah, blah;
Blah, blah;
Blah;
Blah, blah…
Read
Read
Write
Read
Language Integration
SET
foo1=“value”
SET ^foo2=“value”
foo1=“value”
foo2 = ewd.GlobalNode(…)
Language Integration: Hash
http://www.ruby-doc.org/core-2.0.0/Hash.html
Language Integration
foo = {“asia” => 1,“africa” => 2}
foo = {:asia => 1, :africa => 2}
foo = {asia: 1, africa: 2}
foo[:asia]
 1
Language Integration
How it could look like…
bar.asia.japan = “sushi”
Language Integration
A Native JSON
Database
in Ruby !
Language Integration
How it could look like…
knights = {'gallahad': 'pure', 'robin': 'brave'}
knightsBar.gallahad = ‘pure’
http://www.ruby-doc.org/core-2.0.0/Hash.html
Language Integration
How it could look like…
knightsBar.each do | key, value |
puts key
puts value
end
http://docs.python.org/2/tutorial/datastructures.html
Questions?
Luis Ibanez
[email protected]
Descargar

Document