SlideShare a Scribd company logo
 
Our demo: Real-time  c ollaborative city planner Changes are distributed using XMPP XMPP bot updates traffic patterns Runs in Javascript on the server Welcome!
What is O 3 ? Collection of C++ components, made available through Javascript API Runs on all major browsers, and all major operating systems Library to create scriptable C++ components
What is O 3 ? Comes in two flavors: O 3  client-side: Runs as plug-in in the browser Extends DOM API with O3 components Useful if you’re developing in the browser O 3  server-side:  Runs as standalone application Uses Google’s V8 engine to run scripts Provides the same components
What is O 3 ? All O3 components are available on both the client and the server! To use O3 at the client, you need a plugin however…
What is O3? O3 Library consists of three parts: Component model Reflection layer Containers, algorithms, etc.
Component model Subset of Microsoft’s COM specification (as opposed to XPCOM, CORBA, etc.) Looks like this: o3_iid(iFoo, 0x3F2504E0, 0x4F89, 0x11D3,   0x9A, 0x0C, 0x03, 0x05, 0xE8, 0x2C, 0x33, 0x01); struct iFoo : iUnk {   virtual void bar(int x) = 0; }; o3_cls(cFoo) struct cFoo : cUnk, iFoo {   o3_begin_class(cUnk)   o3_add_iface(iFoo)   o3_end() };
Reflection layer Special interface: struct iScr : iUnk {   int resolve(const char*);   void invoke(iCtx* ctx, Access access,   int id, int argc, Var* argv,   Var* rval, Ex* ex);   … }; Allows you to query C++ objects for their methods and properties! Indexed based because some script engines require this (i.e. IDispatch)
Containers, algorithms, etc. We don’t use STL (although you could!) Our containers have lots of useful features and optimizations: Stack allocation for small strings Copy-on write semantics Automatic UTF-8/UTF-16 conversion (not possible with STL) Vectors are scriptable as well! (using Array interface)
Writing components Writing O3 components is easy! All you need to do is add some tags: o3_get int value();  // getter o3_set int setValue(int value); // setter o3_fun int function(int x);  // function Code generator will do the rest! (also written in Javascript)
Writing components We want our components to be as fast as possible! Immediate properties: o3_imm_get int foo;  // read-only o3_imm_set int bar;  // write-only o3_imm  int value; // read/write No getters/setters are generated, properties are accessed directly.
Writing components We want to be able to load components on the fly! Extension properties: In C++: o3_ext(“cO3”) o3_fun static int test(int x); In Javascript: o3.loadModule(“test”); o3.test(3);
Dealing with async Use threads to implement asynchronous Javascript calls. Use message passing to implement callbacks This requires an explicit message loop on the server: while (true)   o3.wait(); Not needed at the client! (We can hook into the browser message loop there…)
HTTP Component Based on XMLHttpRequest API Example: var http = o3.http(); http.onprogress = function(http) {   if (http.bytesReceived > 10000)   …  } http.onreadystatechange = function(http) {   if (http.readystate == http.COMPLETED)   … } http.open(“GET”, “www.ajax.org”); http.send();
XML Component Based on XML DOM API Example: var xml  = o3.xml(); var doc  = xml.parseFromString(string); var element = doc.documentElement; for (var child = element.firstChild;   child  != element.lastChild;   child  = child.nextSibling)   …
FS Component Example: var cwd  = o3.cwd; var file = cwd.get(“test.txt”); file.onchange = function(file) {   file.copy(cwd.get(“test.bak”)); } We’re working on other components as well! IMAGE SOCKET JS
Putting it together Wait for update from XMPP server (using HTTP) Parse XMPP data (using XML) Calculate traffic patterns (using trip generation) Notify server of changes (using HTTP)
Thank you!

More Related Content

PDF
A look into the sanitizer family (ASAN & UBSAN) by Akul Pillai
PDF
Java Week4(B) Notepad
PDF
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
PDF
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
PDF
Engineering Efficiency in LINE
PPTX
Introduction to .NET
PDF
JavaScript for Web Analysts
PPT
cpp input & output system basics
A look into the sanitizer family (ASAN & UBSAN) by Akul Pillai
Java Week4(B) Notepad
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ Builder
Engineering Efficiency in LINE
Introduction to .NET
JavaScript for Web Analysts
cpp input & output system basics

What's hot (19)

PPTX
expression in cpp
PDF
DConf 2016: Keynote by Walter Bright
PDF
THE IO LIBRARY in C++
PPTX
String .h
PPTX
Compile time polymorphism
PPTX
Ruby basics ||
PPTX
C++ Presentation
PDF
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
PDF
Clojure+ClojureScript Webapps
PPTX
Typescript tips & tricks
DOCX
Cifrado cesar
PDF
Address/Thread/Memory Sanitizer
PDF
Конверсия управляемых языков в неуправляемые
PDF
JavaScript: Patterns, Part 2
PDF
How to become a Kotlin developer in 10 mins
PDF
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
PDF
Modern C++
PDF
Meetup C++ A brief overview of c++17
PPTX
Introduction to c_plus_plus (6)
expression in cpp
DConf 2016: Keynote by Walter Bright
THE IO LIBRARY in C++
String .h
Compile time polymorphism
Ruby basics ||
C++ Presentation
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
Clojure+ClojureScript Webapps
Typescript tips & tricks
Cifrado cesar
Address/Thread/Memory Sanitizer
Конверсия управляемых языков в неуправляемые
JavaScript: Patterns, Part 2
How to become a Kotlin developer in 10 mins
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Modern C++
Meetup C++ A brief overview of c++17
Introduction to c_plus_plus (6)
Ad

Viewers also liked (20)

PPS
Japanische Erfindungen
PPTX
открытки8марта
PPT
Интернет-рынок в Беларуси
PPS
Apresentacao Da Turma
PPT
Diplomado en medicina familiar
PPT
Loredana De Groaza
DOCX
Flyer chu..
PDF
Atm milano deposito metropolitana
DOC
Twitter
DOC
Page 7
DOCX
Troll Face
DOC
Vlad tepes
DOCX
PDF
Nonprofit marketing program 2012 presentation08 fonte #npomap2012
PDF
Svalbar lunchmeny feb 2013
PPTX
Final Draft Front Cover
ODT
La vida
PPTX
Moodboard
PPTX
Japanische Erfindungen
открытки8марта
Интернет-рынок в Беларуси
Apresentacao Da Turma
Diplomado en medicina familiar
Loredana De Groaza
Flyer chu..
Atm milano deposito metropolitana
Twitter
Page 7
Troll Face
Vlad tepes
Nonprofit marketing program 2012 presentation08 fonte #npomap2012
Svalbar lunchmeny feb 2013
Final Draft Front Cover
La vida
Moodboard
Ad

Similar to Server Side JavaScript: Ajax.org O3 (20)

KEY
node.js: Javascript's in your backend
PDF
ooc - OSDC 2010 - Amos Wenger
PDF
Nodejs - Should Ruby Developers Care?
PDF
How to-node-core
PPTX
C++ and UIs: an unorthodox approach
PDF
PHP is the King, nodejs the prince and python the fool
PDF
PHP is the king, nodejs is the prince and Python is the fool - Alessandro Cin...
PDF
Apereo OAE - Bootcamp
PDF
Server Side JavaScript - You ain't seen nothing yet
PDF
node.js, javascript and the future
KEY
Let's run JavaScript Everywhere
PDF
Mastering the IoT With JavaScript and C++ - Günter Obiltschnig
PDF
Node.js and How JavaScript is Changing Server Programming
PDF
Ajax Tutorial
PDF
Developing realtime apps with Drupal and NodeJS
PDF
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
PDF
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
PDF
Nodejs - A quick tour (v6)
PDF
OW2con'14 - erOCCI, a scalable, model-based REST API framework
 
PDF
erocci, a scalable model-driven REST framework
node.js: Javascript's in your backend
ooc - OSDC 2010 - Amos Wenger
Nodejs - Should Ruby Developers Care?
How to-node-core
C++ and UIs: an unorthodox approach
PHP is the King, nodejs the prince and python the fool
PHP is the king, nodejs is the prince and Python is the fool - Alessandro Cin...
Apereo OAE - Bootcamp
Server Side JavaScript - You ain't seen nothing yet
node.js, javascript and the future
Let's run JavaScript Everywhere
Mastering the IoT With JavaScript and C++ - Günter Obiltschnig
Node.js and How JavaScript is Changing Server Programming
Ajax Tutorial
Developing realtime apps with Drupal and NodeJS
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
Nodejs - A quick tour (v6)
OW2con'14 - erOCCI, a scalable, model-based REST API framework
 
erocci, a scalable model-driven REST framework

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
Per capita expenditure prediction using model stacking based on satellite ima...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
20250228 LYD VKU AI Blended-Learning.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
The AUB Centre for AI in Media Proposal.docx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Digital-Transformation-Roadmap-for-Companies.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development

Server Side JavaScript: Ajax.org O3

  • 1.  
  • 2. Our demo: Real-time c ollaborative city planner Changes are distributed using XMPP XMPP bot updates traffic patterns Runs in Javascript on the server Welcome!
  • 3. What is O 3 ? Collection of C++ components, made available through Javascript API Runs on all major browsers, and all major operating systems Library to create scriptable C++ components
  • 4. What is O 3 ? Comes in two flavors: O 3 client-side: Runs as plug-in in the browser Extends DOM API with O3 components Useful if you’re developing in the browser O 3 server-side: Runs as standalone application Uses Google’s V8 engine to run scripts Provides the same components
  • 5. What is O 3 ? All O3 components are available on both the client and the server! To use O3 at the client, you need a plugin however…
  • 6. What is O3? O3 Library consists of three parts: Component model Reflection layer Containers, algorithms, etc.
  • 7. Component model Subset of Microsoft’s COM specification (as opposed to XPCOM, CORBA, etc.) Looks like this: o3_iid(iFoo, 0x3F2504E0, 0x4F89, 0x11D3, 0x9A, 0x0C, 0x03, 0x05, 0xE8, 0x2C, 0x33, 0x01); struct iFoo : iUnk { virtual void bar(int x) = 0; }; o3_cls(cFoo) struct cFoo : cUnk, iFoo { o3_begin_class(cUnk) o3_add_iface(iFoo) o3_end() };
  • 8. Reflection layer Special interface: struct iScr : iUnk { int resolve(const char*); void invoke(iCtx* ctx, Access access, int id, int argc, Var* argv, Var* rval, Ex* ex); … }; Allows you to query C++ objects for their methods and properties! Indexed based because some script engines require this (i.e. IDispatch)
  • 9. Containers, algorithms, etc. We don’t use STL (although you could!) Our containers have lots of useful features and optimizations: Stack allocation for small strings Copy-on write semantics Automatic UTF-8/UTF-16 conversion (not possible with STL) Vectors are scriptable as well! (using Array interface)
  • 10. Writing components Writing O3 components is easy! All you need to do is add some tags: o3_get int value(); // getter o3_set int setValue(int value); // setter o3_fun int function(int x); // function Code generator will do the rest! (also written in Javascript)
  • 11. Writing components We want our components to be as fast as possible! Immediate properties: o3_imm_get int foo; // read-only o3_imm_set int bar; // write-only o3_imm int value; // read/write No getters/setters are generated, properties are accessed directly.
  • 12. Writing components We want to be able to load components on the fly! Extension properties: In C++: o3_ext(“cO3”) o3_fun static int test(int x); In Javascript: o3.loadModule(“test”); o3.test(3);
  • 13. Dealing with async Use threads to implement asynchronous Javascript calls. Use message passing to implement callbacks This requires an explicit message loop on the server: while (true) o3.wait(); Not needed at the client! (We can hook into the browser message loop there…)
  • 14. HTTP Component Based on XMLHttpRequest API Example: var http = o3.http(); http.onprogress = function(http) { if (http.bytesReceived > 10000) … } http.onreadystatechange = function(http) { if (http.readystate == http.COMPLETED) … } http.open(“GET”, “www.ajax.org”); http.send();
  • 15. XML Component Based on XML DOM API Example: var xml = o3.xml(); var doc = xml.parseFromString(string); var element = doc.documentElement; for (var child = element.firstChild; child != element.lastChild; child = child.nextSibling) …
  • 16. FS Component Example: var cwd = o3.cwd; var file = cwd.get(“test.txt”); file.onchange = function(file) { file.copy(cwd.get(“test.bak”)); } We’re working on other components as well! IMAGE SOCKET JS
  • 17. Putting it together Wait for update from XMPP server (using HTTP) Parse XMPP data (using XML) Calculate traffic patterns (using trip generation) Notify server of changes (using HTTP)