SlideShare a Scribd company logo
1 of 152
Alan
Arentsen
the coolest APEX examples
Ultimate Node.js countdown
Alan
Arentsen
the coolest APEX examples
Ultimate Node.js countdown
@alanarentsen
alanarentsen.blogspot.com
Fast
Trustworthy
Fast
Trustworthy
Fast
Scalable
Node.js uses an event-driven, non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run across
distributed devices.
s an event-driven, non-blocking I/O m
kes it lightweight and efficient, perfect
ntensive real-time applications that ru
across distributed devices.
http
websocket
rest
oracle-db
https
grunt
socket.io
pythonuglify-js
soap-q
gulp
mysql
filbert
moment
q-superagent
async
jshint
browserify
stylus
cheerio
hapi
less
forever
chalk
redis
underscore
mocha
sails
mongoose
commander
express
connect
nodemailer
mongodb-q
mkdir
bower
awesomepassport
optimist
lodash
colors
qjade
validator
dropbox
http
websocket
rest
oracle-db
https
grunt
socket.io
pythonuglify-js
soap-q
gulp
mysql
filbert
moment
q-superagent
async
jshint
browserify
stylus
cheerio
hapi
less
forever
chalk
redis
underscore
mocha
sails
mongoose
commander
express
connect
nodemailer
mongodb-q
mkdir
bower
awesomepassport
optimist
lodash
colors
qjade
validator
dropbox
message
task
data
data
task
payload
task
{
"task":"what you want the other side to do",
"payload":"is the data you want to send"
}
//websockets
$(function() {
});
window.WebSocket = window.WebSocket || window.MozWebSocket;
if (!window.WebSocket) {
console.log('There is no websocket API available.');
}
} else if (typeof(ws_connection) !== 'undefined') {
console.log('There is a websocket live connection.');
}
else {
ws_connection = new WebSocket('ws://192.168.56.12:4880/&APP_USER.‘
,'echo-protocol');
ws_connection.onmessage = function(message) {
}
}
var jsonMsg = JSON.parse(message.data);
console.log('Received: ' + message.data);
apex.event.trigger(document, jsonMsg.task, jsonMsg.payload);
How do we do it….
How do we do it…. together
Chatbox
Group DEMO
v_chatmessage = apex.item('P8_CHAT_MESSAGE').getValue();
jsonMsg = JSON.stringify({"task" :"chat_message"
,"payload":{message: v_chatmessage}}
);
ws_connection.send (jsonMsg);
v_chatmessage = apex.item('P8_CHAT_MESSAGE').getValue();
jsonMsg = JSON.stringify({"task" :"chat_message"
,"payload":{message: v_chatmessage}}
);
ws_connection.send (jsonMsg);
v_chatmessage = apex.item('P8_CHAT_MESSAGE').getValue();
jsonMsg = JSON.stringify({"task" :"chat_message"
,"payload":{message: v_chatmessage}}
);
ws_connection.send (jsonMsg);
Auto Refresh Report
function reportrefresh_Callback(staticID) {
$('#' + staticID).trigger('apexrefresh');
};
var intervalID = window.setInterval(reportrefresh_Callback('EMP'), 5000);
function reportrefresh_Callback(staticID) {
$('#' + staticID).trigger('apexrefresh');
};
var intervalID = window.setInterval(reportrefresh_Callback('EMP'), 5000);
Group DEMO
Websockets
Websockets
apex.event.trigger(document, jsonMsg.task, jsonMsg.payload);
Event: Custom
Event: Custom
Custom Event: refresh_emp
Event: Custom
Custom Event: refresh_emp
Selection Type: JavaScript Expression
Event: Custom
Custom Event: refresh_emp
Selection Type: JavaScript Expression
Javascript Expression: document
oracle_db
oracle = function() {
this.oracledb = require("oracledb");
};
oracle.prototype.insertUser = function(p_username, p_remoteaddress, p_userkey) {
this.oracledb.getConnection({
user: this.db_user,
password: this.db_password,
connectString: this.db_connectionstring
},
function(err, connection) {
//put your code to handle the callback here
});
};
oracle = function() {
this.oracledb = require("oracledb");
};
oracle.prototype.insertUser = function(p_username, p_remoteaddress, p_userkey) {
this.oracledb.getConnection({
user: this.db_user,
password: this.db_password,
connectString: this.db_connectionstring
},
function(err, connection) {
//put your code to handle the callback here
});
};
oracle = function() {
this.oracledb = require("oracledb");
};
oracle.prototype.insertUser = function(p_username, p_remoteaddress, p_userkey) {
this.oracledb.getConnection({
user: this.db_user,
password: this.db_password,
connectString: this.db_connectionstring
},
function(err, connection) {
//put your code to handle the callback here
});
};
function(err, connection) {
if (err) {
console.error(err.message);
return;
}
connection.action = "insertUser";
connection.module = process.title;
var sqlstatement = "merge into unc_users usr 
using (select :username username 
,:remoteaddress remoteaddress 
,:userkey userkey 
from dual) usr1 
on (usr.username = usr1.username) 
when matched then 
update set usr.userkey = usr1.userkey 
when not matched then 
insert (username, remoteaddress, userkey)
values (usr1.username, usr1.remoteaddress, usr1.userkey)";
function(err, connection) {
if (err) {
console.error(err.message);
return;
}
connection.action = "insertUser";
connection.module = process.title;
var sqlstatement = "merge into unc_users usr 
using (select :username username 
,:remoteaddress remoteaddress 
,:userkey userkey 
from dual) usr1 
on (usr.username = usr1.username) 
when matched then 
update set usr.userkey = usr1.userkey 
when not matched then 
insert (username, remoteaddress, userkey)
values (usr1.username, usr1.remoteaddress, usr1.userkey)";
function(err, connection) {
if (err) {
console.error(err.message);
return;
}
connection.action = "insertUser";
connection.module = process.title;
var sqlstatement = "merge into unc_users usr 
using (select :username username 
,:remoteaddress remoteaddress 
,:userkey userkey 
from dual) usr1 
on (usr.username = usr1.username) 
when matched then 
update set usr.userkey = usr1.userkey 
when not matched then 
insert (username, remoteaddress, userkey)
values (usr1.username, usr1.remoteaddress, usr1.userkey)";
select v.action
,v.module
,v.sql_text
from v$sql v
where v.parsing_schema_name = 'SANDBOX'
function(err, connection) {
if (err) {
console.error(err.message);
return;
}
connection.action = "insertUser";
connection.module = process.title;
var sqlstatement = "merge into unc_users usr 
using (select :username username 
,:remoteaddress remoteaddress 
,:userkey userkey 
from dual) usr1 
on (usr.username = usr1.username) 
when matched then 
update set usr.userkey = usr1.userkey 
when not matched then 
insert (username, remoteaddress, userkey)
values (usr1.username, usr1.remoteaddress, usr1.userkey)";
connection.execute(sqlstatement
,[p_username, p_remoteaddress, p_userkey]
,{autoCommit: true}
,function(err, result) {
if (err) {
console.error(err.message);
return;
}
});
}
Google Maps
Group DEMO
DBMS_JOB
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
Group DEMO
Progress Bar
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
10%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
20%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
30%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
40%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
50%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
60%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
70%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
80%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
90%
declare
jid pls_integer;
begin
dbms_job.submit (jid
,'begin
//do the job
end;'
);
end;
100%
Group DEMO
apex_web_service.make_rest_request(
p_url => 'http://192.168.56.12:4880/',
p_http_method => 'PUT',
p_body => '{"task" : "dbms_job_ready"
,"payload": {"job": job_identifier}}'
);
apex_web_service.make_rest_request(
p_url => 'http://192.168.56.12:4880/',
p_http_method => 'PUT',
p_body => '{"task" : "dbms_job_ready"
,"payload": {"job": job_identifier}}'
);
req.on('data', function(data) {
var body = JSON.parse(data.toString());
if (body.task == 'dbms_job_ready') {
//code to send dbms_job_ready event to clients
} else if (body.task == 'dbms_job_status') {
var msgStringOut = JSON.stringify({task : body.task
,payload: {job : body.payload.job
,perc: body.payload.percentage}
});
for(var i in clients){
clients[i].sendUTF(msgStringOut);
};
resp.end(JSON.stringify({ message: 'Send to '+ clients.length + ' clients‘
}));
};
);
req.on('data', function(data) {
var body = JSON.parse(data.toString());
if (body.task == 'dbms_job_ready') {
//code to send dbms_job_ready event to clients
} else if (body.task == 'dbms_job_status') {
var msgStringOut = JSON.stringify({task : body.task
,payload: {job : body.payload.job
,perc: body.payload.percentage}
});
for(var i in clients){
clients[i].sendUTF(msgStringOut);
};
resp.end(JSON.stringify({ message: 'Send to '+ clients.length + ' clients‘
}));
};
);
req.on('data', function(data) {
var body = JSON.parse(data.toString());
if (body.task == 'dbms_job_ready') {
//code to send dbms_job_ready event to clients
} else if (body.task == 'dbms_job_status') {
var msgStringOut = JSON.stringify({task : body.task
,payload: {job : body.payload.job
,perc: body.payload.percentage}
});
for(var i in clients){
clients[i].sendUTF(msgStringOut);
};
resp.end(JSON.stringify({ message: 'Send to '+ clients.length + ' clients‘
}));
};
);
req.on('data', function(data) {
var body = JSON.parse(data.toString());
if (body.task == 'dbms_job_ready') {
//code to send dbms_job_ready event to clients
} else if (body.task == 'dbms_job_status') {
var msgStringOut = JSON.stringify({task : body.task
,payload: {job : body.payload.job
,perc: body.payload.percentage}
});
for(var i in clients){
clients[i].sendUTF(msgStringOut);
};
resp.end(JSON.stringify({ message: 'Send to '+ clients.length + ' clients‘
}));
};
);
req.on('data', function(data) {
var body = JSON.parse(data.toString());
if (body.task == 'dbms_job_ready') {
//code to send dbms_job_ready event to clients
} else if (body.task == 'dbms_job_status') {
var msgStringOut = JSON.stringify({task : body.task
,payload: {job : body.payload.job
,perc: body.payload.percentage}
});
for(var i in clients){
clients[i].sendUTF(msgStringOut);
};
resp.end(JSON.stringify({ message: 'Send to '+ clients.length + ' clients‘
}));
};
);
req.on('data', function(data) {
var body = JSON.parse(data.toString());
if (body.task == 'dbms_job_ready') {
//code to send dbms_job_ready event to clients
} else if (body.task == 'dbms_job_status') {
var msgStringOut = JSON.stringify({task : body.task
,payload: {job : body.payload.job
,perc: body.payload.percentage}
});
for(var i in clients){
clients[i].sendUTF(msgStringOut);
};
resp.end(JSON.stringify({ message: 'Send to '+ clients.length + ' clients‘
}));
};
);
Dropbox
Group DEMO
dropbox = function() {
this.dropbox_pkg = require("dropbox");
this.dropbox_client = new dropbox_pkg.Client({"key" : this.db_key
,"secret" : this.db_secret
,"token" : this.db_token
,"sandbox": false});
};
dropbox = function() {
this.dropbox_pkg = require("dropbox");
this.dropbox_client = new dropbox_pkg.Client({"key" : this.db_key
,"secret" : this.db_secret
,"token" : this.db_token
,"sandbox": false});
};
dropbox.prototype.getAccountInfo = function(callback) {
this.dropbox_client.getAccountInfo(function(error, accountInfo) {
if (error) {
callback(error, null);
return;
}
callback(null, accountInfo);
});
};
dropbox.getAccountInfo(function(error, accountInfo){
//put your code to handle the callback here
});
dropbox.prototype.getAccountInfo = function(callback) {
this.dropbox_client.getAccountInfo(function(error, accountInfo) {
if (error) {
callback(error, null);
return;
}
callback(null, accountInfo);
});
};
dropbox.getAccountInfo(function(error, accountInfo){
//put your code to handle the callback here
});
dropbox.prototype.getAccountInfo = function(callback) {
this.dropbox_client.getAccountInfo(function(error, accountInfo) {
if (error) {
callback(error, null);
return;
}
callback(null, accountInfo);
});
};
dropbox.getAccountInfo(function(error, accountInfo){
//put your code to handle the callback here
});
https://www.chromeexperiments.com/experiment/world-wide-maze
http://dinahmoelabs.com/plink
Some fun stuff to look at
Alan Arentsen
alan.arentsen@ordina.nl
alanarentsen.blogspot.com

More Related Content

What's hot

Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.jsMatthew Beale
 
Ember and containers
Ember and containersEmber and containers
Ember and containersMatthew Beale
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is HumanAlex Liu
 
Ruby on Rails testing with Rspec
Ruby on Rails testing with RspecRuby on Rails testing with Rspec
Ruby on Rails testing with RspecBunlong Van
 
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJSFestUA
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSPat Cito
 
$q and Promises in AngularJS
$q and Promises in AngularJS $q and Promises in AngularJS
$q and Promises in AngularJS a_sharif
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript PromisesTomasz Bak
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3Luciano Mammino
 
Automated Testing in EmberJS
Automated Testing in EmberJSAutomated Testing in EmberJS
Automated Testing in EmberJSBen Limmer
 
Jasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyJasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyIgor Napierala
 
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...GreeceJS
 
Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015Morris Singer
 
Workshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte IIIWorkshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte IIIVisual Engineering
 
The Promised Land (in Angular)
The Promised Land (in Angular)The Promised Land (in Angular)
The Promised Land (in Angular)Domenic Denicola
 
Complex Architectures in Ember
Complex Architectures in EmberComplex Architectures in Ember
Complex Architectures in EmberMatthew Beale
 
You do not need automation engineer - Sqa Days - 2015 - EN
You do not need automation engineer  - Sqa Days - 2015 - ENYou do not need automation engineer  - Sqa Days - 2015 - EN
You do not need automation engineer - Sqa Days - 2015 - ENIakiv Kramarenko
 

What's hot (20)

Step objects
Step objectsStep objects
Step objects
 
Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.js
 
Ember and containers
Ember and containersEmber and containers
Ember and containers
 
Promise pattern
Promise patternPromise pattern
Promise pattern
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
 
Ruby on Rails testing with Rspec
Ruby on Rails testing with RspecRuby on Rails testing with Rspec
Ruby on Rails testing with Rspec
 
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c HermioneJS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
$q and Promises in AngularJS
$q and Promises in AngularJS $q and Promises in AngularJS
$q and Promises in AngularJS
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
How to send gzipped requests with boto3
How to send gzipped requests with boto3How to send gzipped requests with boto3
How to send gzipped requests with boto3
 
Automated Testing in EmberJS
Automated Testing in EmberJSAutomated Testing in EmberJS
Automated Testing in EmberJS
 
Jasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyJasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishy
 
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
 
Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015Unit Testing Express and Koa Middleware in ES2015
Unit Testing Express and Koa Middleware in ES2015
 
Workshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte IIIWorkshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte III
 
The Promised Land (in Angular)
The Promised Land (in Angular)The Promised Land (in Angular)
The Promised Land (in Angular)
 
Boost your angular app with web workers
Boost your angular app with web workersBoost your angular app with web workers
Boost your angular app with web workers
 
Complex Architectures in Ember
Complex Architectures in EmberComplex Architectures in Ember
Complex Architectures in Ember
 
You do not need automation engineer - Sqa Days - 2015 - EN
You do not need automation engineer  - Sqa Days - 2015 - ENYou do not need automation engineer  - Sqa Days - 2015 - EN
You do not need automation engineer - Sqa Days - 2015 - EN
 

Similar to Ultimate Node.js countdown: the coolest Application Express examples

Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Build Web Apps using Node.js
Build Web Apps using Node.jsBuild Web Apps using Node.js
Build Web Apps using Node.jsdavidchubbs
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptGuy Royse
 
Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Codemotion
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyDavid Padbury
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gearsdion
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptVisual Engineering
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescriptDavid Furber
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Kogito: cloud native business automation
Kogito: cloud native business automationKogito: cloud native business automation
Kogito: cloud native business automationMario Fusco
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
Introduction to nodejs
Introduction to nodejsIntroduction to nodejs
Introduction to nodejsJames Carr
 
Javascript is your (Auto)mate
Javascript is your (Auto)mateJavascript is your (Auto)mate
Javascript is your (Auto)mateCodemotion
 

Similar to Ultimate Node.js countdown: the coolest Application Express examples (20)

Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
 
Build Web Apps using Node.js
Build Web Apps using Node.jsBuild Web Apps using Node.js
Build Web Apps using Node.js
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
 
Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
 
Capistrano2
Capistrano2Capistrano2
Capistrano2
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Kogito: cloud native business automation
Kogito: cloud native business automationKogito: cloud native business automation
Kogito: cloud native business automation
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Dojo and Adobe AIR
Dojo and Adobe AIRDojo and Adobe AIR
Dojo and Adobe AIR
 
Introduction to nodejs
Introduction to nodejsIntroduction to nodejs
Introduction to nodejs
 
Javascript is your (Auto)mate
Javascript is your (Auto)mateJavascript is your (Auto)mate
Javascript is your (Auto)mate
 

Recently uploaded

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 

Recently uploaded (20)

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Ultimate Node.js countdown: the coolest Application Express examples

Editor's Notes

  1. Oh first of all Node.js It’s not just a simple framework, Many large organisations use it to create their websites
  2. LinkedIn used Node.js to create their mobile website http://venturebeat.com/2011/08/16/linkedin-node/
  3. PayPal stopped using Java and started using Node.js to create their website https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/
  4. Walmart uses Node.js for their mobile app and uses it as a proxy between different programming API’s https://www.joyent.com/developers/videos/node-js-at-walmart-introduction
  5. Basicly what PayPal, LinkedIn and Walmart wanted to do is: Make an mobile application for all the people on the internet
  6. And it has to be fast
  7. Trustworthy
  8. And maybe most of all scalable
  9. And that’s why they chose Node.js But what is it? Does anybody know wat node is?
  10. Has anybody seen our LEGO presentation with Node.js?
  11. Well this is what Node.js is. “Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.”
  12. This is the important part. It’s event driven, so it can react on events. And it’s non-blocking wich means it’s asynchronous. And it is JavaScript
  13. Basicly it’s JavaScript on a server
  14. And you can run it from the Oracle cloud if you want
  15. Once you’ve installed node or you use it from the cloud you start with an empty canvas. So you can start writing your code. But it’s a lot of work because in order to use for example websockets you will need a webserver and a websocket server.
  16. That’s were the Node Package Manager comes in. The open source community allready have written a lot of code and you can download these and use them in the NPM
  17. We are only going to use these ones
  18. What I wanted to do in this presentation is send a message from apex to nodejs and back
  19. So i had to define a message
  20. I thought it had to some kind of task the receiver should run
  21. And of course i needed to send some data with it
  22. So in the message there should me a task part and a data part
  23. Finaly i came up with my message with a task and a payload
  24. And now I needed a way to transport the data to node.js Therefore I used a websocket connection. With the websocket connection I can make a direct connection between a webbrowser and node.js
  25. I have to find some kind a way to send the data over the websocket connection from apex to node.js That’s where json comes in.
  26. I needed a json message with a task and a payload in it The task is what we want the other side to do And the payload is the data you want to send to the other side
  27. Ok but how can we fix this in APEX?
  28. First of all, there are several ways to do this. One way is to integrate your code into your page. That’s ok if you only use websockets on a single page. I like to change the page template and add my code for setting up the websocket connection on it So we navigate to shared components and click on templates.
  29. First we set up a global variable which holds the websocket connection And then we add the code to set up the connection
  30. This code start with a anonymous javascript function
  31. The first part is to check if you have browser support for websockets
  32. After that I check if there is allready a websocket connection initialized.
  33. If the browser supports websockets, and there isnt a live websocket connection, we create an instance of the websocket And because node is event driven, we create an event which fires when a message is received.
  34. When a message is received we parse the json message into a javascript object
  35. And then we use this object to fire an apex trigger. We can catch this trigger with a dynamic action, I will show you later on how to do it.
  36. Well now its fixed in APEX we have to do something on our node.js server. I’ve allready installed a webserver with the websocket implementation it it.
  37. So all we have to do right now is to implement the event handling of the websocket server.
  38. At first we accept the connection and we save some important information about the connected client. Then we push the client up the client list
  39. Because it’s event driven we have to implement some events. And it is all done in asynchronous callback functions. You wil see them a lot if you start working with node. This specific event will fire when the connection receives a message with the name ‘message’ You can put your code to handle the event in this callback function
  40. In example what we are doing is sending a json string
  41. And we do the same thing as we did on the APEX part. We parse the json message string into a javascript object And then we can find out easily what kind of task we should run
  42. If we wanted to broadcast some data to all the connected client we will be doing a thing like this. We loop through the connected clients and contruct a new json string wich we send to all the clients
  43. Ok now we are all experts in using Node.js Im going to show you a few example implementations. But we do it in a special way.
  44. At first i wil explain the idea Second i will do a live demo Then i am going to explain the techniques i used And after all you are rating this example And we do it topgear style. Does anybody know topgear? [explain topgear and the cool wall]
  45. [explain the cool wall]
  46. We won’t be needing the seriously uncool part. Because I can’t image a seriously uncool part of Node.js
  47. So we stick with uncool, cool and subzero
  48. As an example I added the lego presentation to the cool wall. I placed in at sub zero level, i hope you don’t mind.
  49. Let’s start with the first example. I wanted to create a simple checkbox.
  50. I type a message on the screen of my device and the send the message to node
  51. Node is his turn sends the message to all the connected users. You can use this concept as a chat functionality on your website. You can use it as a one on many or with little adjustments a one on one example
  52. So what i did in APEX is getting the value of the page item
  53. Construct a JSON string with the task ‘chat_message’ and the message itself as payload
  54. And then sent the message over the websocket connection
  55. I node I used caught the message event and looked for the ‘chat_message’
  56. After that I contruct a new message for the users to receive
  57. And sent it out to all the connected clients Including myself
  58. Say we have to people looking at a report on their mobile device. Then some data is added to the report
  59. Then some data is added to the report And you want both of your reports refreshed.
  60. Well one way to do this is to creeate a trigger wich refreshes the report
  61. And we do that on an interval we define in advance I don’t want to do that. Thats called polling.
  62. What I want is to just sit and wait and watch my report beeing refreshed. And it’s all possible thanks to websockets and nodejs
  63. So i did the change on the phone Sent the change message to node And node distributes the message to all the connected clients Something like I explained you in the chat application
  64. Well I promised to tell you more about the apex event trigger earlier on
  65. Well I promised to tell you more about the apex event trigger earlier on. When we receive a message from the node server we send out apex event trigger The trigger fires on the document . The task will be the event name. And the payload will be the data part of the event.
  66. We create a dynamic action on a custom event
  67. The event name will be the task name of my json object
  68. And as a selection type criteria we choose a javascript expression
  69. The expression is the document, thats what we defined when we fired the event
  70. And we can start creating some actions. In our example I do a refresh
  71. On GitHub you can find a lot of stuff Facebook and Twitter are using GitHub Oh yeah and also NASA Over 10 Million repositories One of them is the node-oracledb repository
  72. One of them is the node-oracledb repository You can download it from github and use the node package manager to install the package.
  73. Then you can start building your own oracle connection in Node. I use it in de Demo to store all the users in the oracle database. First I include the oracledb package
  74. Then I implement the insert user function Therefore I first create a connection to the oracle database like this.
  75. Then there is this callback function you use to implement your code when you are connected to the database
  76. My function looks like this, you can copy this code if you want
  77. If there is an error i just print it out to the console
  78. Then i set the action and module name
  79. You can use them from sqlplus to get some statistics. V$SQL lists statistics on shared SQL area without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution. However, for long running queries, they are updated every 5 seconds. This makes it easy to see the impact of long running SQL statements while they are still in progress.
  80. And this is the function wich really does the work It merges the connected user to the user table I first save the statement to a variable
  81. And the execute the statement
  82. And after that all the connected users are synced with the database and i can do anything with them
  83. Like sending a specific message to one user.
  84. If you want to organizing the public space and discuss overe where to put the playgrounds, streets and houses. You most probably are with a group of people discussing this. Redlining refers to the process of adding MapNotes/symbols or drawing shapes to "mark up" GIS layers without actually editing the layers themselves.
  85. If you want to organizing the public space and discuss overe where to put the playgrounds, streets and houses. You most probably are with a group of people discussing this. Redlining refers to the process of adding MapNotes/symbols or drawing shapes to "mark up" GIS layers without actually editing the layers themselves.
  86. If you want to organizing the public space and discuss overe where to put the playgrounds, streets and houses. You most probably are with a group of people discussing this. Redlining refers to the process of adding MapNotes/symbols or drawing shapes to "mark up" GIS layers without actually editing the layers themselves.
  87. If you want to organizing the public space and discuss overe where to put the playgrounds, streets and houses. You most probably are with a group of people discussing this. Redlining refers to the process of adding MapNotes/symbols or drawing shapes to "mark up" GIS layers without actually editing the layers themselves.
  88. I guess everybody requognise the next example. You start a background process and you want to be informed when the job is finished
  89. Well you can poll a lot in apex to check if the job is done. But you can do it without polling
  90. In the previous example we just received a message when the job was done
  91. How nice would it be if we are informed from time to time
  92. How nice would it be if we are informed from time to time
  93. How nice would it be if we are informed from time to time
  94. How nice would it be if we are informed from time to time
  95. How nice would it be if we are informed from time to time
  96. How nice would it be if we are informed from time to time
  97. How nice would it be if we are informed from time to time
  98. How nice would it be if we are informed from time to time
  99. How nice would it be if we are informed from time to time
  100. How nice would it be if we are informed from time to time Until the job is complete
  101. What we did here is make a rest request from the database to the node server
  102. As you can see i use the same json object. You can define your own body if you’d like But i’m sending the message right here: dbms_job_ready With the job identifier in the payload
  103. And on the http server i’ve created this function witch catches the rest request.
  104. At first i parse the json string
  105. And then do something with te data depending on the task With dbms_job_ready i send the job ready event to the clients And with the other message i sent some more information about the job status
  106. And with the other message i sent some more information about the job status
  107. And with the other message i sent some more information about the job status
  108. And with the other message i sent some more information about the job status
  109. And now we have just one demo to go. Everywhere on the internet there are API’s available for different social networks We have dropbox, google, twitter, facebook, linkedin
  110. And many more
  111. And they all have something in common. OAUTH 2
  112. So when you want to connect to one of these api’s you have to use the oauth2 protocol to authenticate.
  113. And after you are authenticated you can use a lot of api functions.
  114. Just as the oracledb package, the dropbox package can be found on github
  115. This was in unofficial, as the oracle db package was is made and maintained by oracle
  116. In node js i first include the dropbox package
  117. Then i authenticate agains a key, a secret and a token
  118. And when i’mconnected i can use all kind of functions Like here im using get accountinfo
  119. And in this part a callback function handles the details
  120. And you can put your details here. I have all the code working on my laptop. Just sent me an email an i can help you getting started.