SlideShare a Scribd company logo
POWERING HUMAN
INTERACTION
POWERING THE ARDUINO WITH ANGULAR
ARI LERNER,
FULLSTACK.IO

Author of ng-book and ng-newsletter
Author of a few others (D3 on Angular, Riding Rails with
AngularJS)
Teacher at HackReactor
Cofounder of Fullstack.io
Background in distributed computing and infrastructure
WHAT

Let's prototype a temperature control system in less than 20
minutes using the Arduino, an open-source hardware platform
and Angular
ARDUINO?
Embedded systems
Wearable computing
Low-power systems
OVERVIEW

Running an HTTP server on the arduino
Requesting the HTML from the arduino
Loading angular app
Communicating to Angular from the Arduino
Communicating to the Arduino from Angular
RUNNING AN HTTP
SERVER
An HTTP server written in C... it's hard...
vi lo( {
od op)
/ lse fricmn cins
/ itn o noig let
EhreCin cin =sre.vial(;
tentlet let
evraalbe)
i (let {
f cin)
wie(letcnetd) {
hl cin.once()
i (letaalbe) {
f cin.vial()
ca c=cin.ed)
hr
letra(;
i ( = 'n & cretiesln){
f c = ' & urnLnIBak
cin.rnl(HT/. 20O";
letpitn"TP11 0 K)
cin.rnl(CnetTp:tx/tl)
letpitn"otn-ye ethm";
cin.rnl(Cneto:coe)
letpitn"oncin ls";
cin.rnl(;
letpitn)
cin.rnl(<1H fo teAdio/1";
letpitn"h>i rm h run<h>)
bek
ra;
}
i ( = 'n){cretiesln =tu;}
f c = '
urnLnIBak
re
es i ( ! 'r){cretiesln =fle }
le f c = '
urnLnIBak
as;
}
}
dly1;
ea()
cin.tp)
letso(;
}
}
ENTER TINYWEBSERVER
Enables simplification of the c HTTP server code
#nld <iyeSre.>
icue TnWbevrh
/ Idxhnlr
/ ne ade
boenidxhnlrTnWbevr wbsre){
ola ne_ade(iyeSre& e_evr
wbsre.rn((<tl<ed<il>e sre<tte<ha>);
e_evrpitF"hm>ha>tteWb evr/il>/ed")
wbsre.rn((<oy<bd>/tl")
e_evrpitF"bd>/oy<hm>);
rtr tu;
eun re
}
/ Hnlr
/ ades
TnWbevr:ahade hnlr[ ={
iyeSre:PtHnlr ades]
{/isdgtl,TnWbevr:OT &iia_i_ade}
"pn/iia" iyeSre:PS, dgtlpnhnlr,
{/is,TnWbevr:E,&ishnlr,
"pn" iyeSre:GT pn_ade}
{/,TnWbevr:E,&ne_ade }
"" iyeSre:GT idxhnlr ,
{UL,
NL}
}
;
cntca*haes]={
os hr edr[
"otn-egh,"-cinLn,NL
CnetLnt" XAto-e" UL
}
;
TnWbevrwb=TnWbevrhnlr,haes;
iyeSre e
iyeSre(ades edr)
/ ..
/ .
vi lo( {
od op)
wbpoes)
e.rcs(;
}
;
CONNECTING TO THE NET
Ethernet shield
Wifi shield

#nld <tenth
icue Ehre.>
bt i[ ={12 18 0 6 }
ye p]
9, 6, , 7 ;
/ ..
/ .
Ehre.ei(a,i)
tentbgnmc p;

DHCP is also supported
BUT WHERE'S THE HTML
OPTIONS
EMBED HTML IN ARDUINO
READ/SEND FROM SD CARD
LOAD FROM REMOTE SERVER
cntca *OT="rdv90"
os hr HS
aie:00;
/ ..
/ .
boenidxhnlrTnWbevr wbsre){
ola ne_ade(iyeSre& e_evr
/ ..
/ .
wbsre.rn((<citi="psrp scht:/);
e_evrpitF"srp dapcit" r="tp/")
wbsre.rn(OT;
e_evrpitHS)
wbsre.rn((/cit/cit.s"<srp>);
e_evrpitF"srpssrpsj>/cit")
/ ..
/ .
}
;
BUT WHERE'S THE
ANGULAR
(ucin){
fnto(
vrsrpTg=dcmn.eEeetBTgae'cit)0;
a cita
ouetgtlmnsyaNm(srp'[]
/ ..
/ .
cetLnTg'tlsmi.s';
raeika(sye/ancs)
vrar=[
a r
'cit/oue/run.s,
srpsmdlsadioj'
'cit/p.s
srpsapj'
/ ..
/ .
]
;
cetSrpTg'oe_opnnsaglraglrj';
raecita(bwrcmoet/nua/nua.s)
cetSrpTg'oe_opnnsaglrrueaglrruej';
raecita(bwrcmoet/nua-ot/nua-ot.s)
arfrahfnto(r){cetSrpTgsc;};
r.oEc(ucinsc
raecita(r) )
/ Bosrp
/ otta
bd.eAtiue'gap,'yp';
oysttrbt(n-p' mAp)
vrap =dcmn.raelmn(dv)
a p
ouetcetEeet'i';
vrmi =dcmn.raelmn(dv)
a an
ouetcetEeet'i';
mi.eAtiue'anve' ')
ansttrbt(mi-iw, ';
apapnCidmi)
p.pedhl(an;
bd.pedhl(p)
oyapnCidap;
}(;
))
COMMAND AND CONTROL
Arduino -> Angular (√)
Angular -> Arduino (...)
EXPOSE THE LOCAL IP TO
THE BROWSER
boenidxhnlrTnWbevr wbsre){
ola ne_ade(iyeSre& e_evr
/ ..
/ .
wbsre.rn((<citwno.p")
e_evrpitF"srp>idwi=");
wbsre.rn(pt_t(p)
e_evrpiti_osri);
wbsre.rn((<srp>);
e_evrpitF""/cit")
/ ..
/ .
}
;
aglrmdl(fAdio,[)
nua.oue'srun' ]
.rvdr'run' fnto( {
poie(Adio, ucin)
ti.eRoUl=fnto(){
hsstotr
ucinu
roUl=u| roUl
otr
| otr;
}
;
ti.gt=fnto(ht){
hs$e
ucin$tp
rtr {
eun
gtis fnto( {,
ePn: ucin) }
stis fnto( {
ePn: ucin) }
}
;
}
};
)

aglrmdl(mAp,[
nua.oue'yp'
'srun'
fAdio
]
)
.ofgfnto(runPoie){
cni(ucinAdiorvdr
Adiorvdrstotr(idwi)
runPoie.eRoUlwno.p;
};
)
SUMMARY OF
HARDWARE HACKING
Turning pins on/HIGH
Turning pins off/LOW
Measuring pin voltage
GETTING PIN STATUS
/ ..
/ .
gtis fnto( {
ePn: ucin)
rtr $tp{
eun ht(
mto:'E'
ehd GT,
ul roUl+'pn'
r: otr
/is
}.hnfnto(aa {
)te(ucindt)
rtr dt.aa
eun aadt;
};
)
}
,
/ ..
/ .
SERVING PIN STATUS
/ GT/is
/ E pn
boenpn_ade(iyeSre&wbsre){
ola ishnlrTnWbevr e_evr
wbsre.ederrcd(0)
e_evrsn_ro_oe20;
wbsre.edcnettp(apiainjvsrp";
e_evrsn_otn_ye"plcto/aacit)
wbsre.n_edr(;
e_evredhaes)
pnTSrn(e_evr;
isotigwbsre)
rtr tu;
eun re
}
/ ..
/ .
bo pnTSrn(iyeSre&wbsre){
ol isotigTnWbevr e_evr
wbsre < F"pn:";
e_evr < ({"is"[)
itln=nmis
n e
uPn;
friti0 iln i+{
o(n =; <e; +)
wbsre < F"pn"";
e_evr < ({"i:)
wbsre < pn[]gti(;
e_evr < isi.ePn)
wbsre < F"vle"";
e_evr < (,"au:)
wbsre < pn[]gttt(;
e_evr < isi.eSae)
wbsre < F"";
e_evr < (})
i (i1 <ln wbsre < F"";
f (+)
e) e_evr < (,)
}
wbsre < F"})
e_evr < (]";
rtr tu;
eun re
}
MODIFYING PIN STATES

Angular works with JSON by default (just javascript), but the
Arduino does not... However, parsing a schemaless data
structure in a strictly typed language is... difficult.
CREATE OUR OWN
PROTOCOL
Turn JSON from:

{pn 7 ato:'eTm'}(4bts
i: , cin gtep
2 ye)

to
pa ( bts
70 4 ye)
ACTIONS
/ i mive drcie
/ n aniw ietv
Adiostis[
run.ePn(
{pn tm,ato:'eTm'}
i: ep cin gtep
];
)
/ i Adiopoie
/ n run rvdr
vratos={
a cin
'eTm' 0
gtep:
}
;
vratoiyis=fnto(is {
a cinfPn
ucinpn)
vrsr=';
a t
'
fr(a i=0 i<pn.egh i+ {
o vr
;
islnt; +)
vrp=pn[]
a
isi;
sr+ ''+ppn
t = p
.i;
i (yefpmd)!='neie' {t + ''+pmd;
f tpo(.oe = udfnd) sr = m
.oe}
i (yefpvle !='neie' {t + ''+pvle}
f tpo(.au) = udfnd) sr = v
.au;
i (yefpato)!='neie' {t + ''+atospato]}
f tpo(.cin = udfnd) sr = a
cin[.cin;
}
rtr sr
eun t;
}
;
{pn 7 ato:'eTm'}(4bts
i: , cin gtep
2 ye)

to
pa ( bts
70 4 ye)
USING IT SERVICE
stis fnto(is {
ePn: ucinpn)
vrsrcin=atoiyispn)
a tAto
cinfPn(is;
rtr $tp{
eun ht(
mto:'OT,
ehd PS'
ul roUl+'pn/iia'
r: otr
/isdgtl,
dt:srcin
aa tAto,
haes {XAto-e' srcinlnt}
edr: '-cinLn: tAto.egh
}.hnfnto(aa {
)te(ucindt)
rtr dt.aa
eun aadt;
};
)
}
PARSING IN C
eu AtoTps{
nm cinye
GTEP
ETM
}
;
/ PS /isdgtl
/ OT pn/iia
boendgtlpnhnlrTnWbevr wbsre){
ola iia_i_ade(iyeSre& e_evr
/ Gtteato lnt
/ e h cin egh
cntca*ato_t_e =wbsre.e_edrvle"-cinLn)
os hr cinsrln
e_evrgthae_au(XAto-e";
itln=ao(cinsrln;
n e
tiato_t_e)
/ Gtterqetdt bsdo telnt
/ e h eus aa ae n h egh
ca*dt =(hr)alcln;
hr aa
ca*mlo(e)
i (aa mme(aa 0 ln;
f dt) estdt, , e)
gtrqetdt(e_evr ln dt)
e_eus_aawbsre, e, aa;
/ ..
/ .
}
;
CONTINUED
itse =sre(aa;
n Ln
tlndt)
iti=0
n
;
wiei<se){
hl(
Ln
i (aai = '' {
f dt[] = p)
/ W aepriganwpn
/ e r asn
e i
pnn =(n)dt[+]-'';
iIt
it(aa+i
0)
Pn* =slc_i(iIt;
i p
eetpnpnn)
wiedt[+]! ''& i<se){
hl(aai+ = p &
Ln
/ W'ei apnojc
/ er n
i bet
sic (aai){
wth dt[]
cs ''
ae a:
i+
+;
atoIt=(n)dt[]-'';
cinn
it(aai
0)
atoT=(cinye)atoIt;
cin
AtoTps(cinn)
sic (cin){
wth atoT
cs GTEP
ae ETM:
crTm =gtepd)
urep
eTm(s;
p>eCretau(urep;
-sturnVlecrTm)
bek
ra;
/ ..
/ .
fotgtepOeiesno)
la eTm(nWr esr{
/rtrstetmeauefo oeD1S0i DGClis
/eun h eprtr rm n S82 n E esu
bt dt[2,ad[]
ye aa1] dr8;
fotclis fhehi;
la esu, arnet
sno.erhad)
esrsac(dr;
sno.ee(;
esrrst)
sno.eetad)
esrslc(dr;
sno.rt(x41;
esrwie04,)
dly10)
ea(00;
bt peet=sno.ee(;
ye rsn
esrrst)
sno.eetad)
esrslc(dr;
sno.rt(xE;
esrwie0B)
fr(n i=0 i<9 i+ {dt[]=sno.ed) }
o it
;
; +)
aai
esrra(;
sno.ee_erh)
esrrstsac(;
bt MB=dt[]
ye S
aa1;
bt LB=dt[]
ye S
aa0;
it6trw=(aa1 < 8 |dt[] rw=rw< 3
n1_ a
dt[] < )
aa0; a
a < ;
i (aa7 = 01){rw=(a &0FF)+1 -dt[] }
f dt[] = x0
a
rw
xF0
2
aa6;
clis=(la)a /1.;
esu
fotrw
60
fhehi =clis*18+3.;
arnet
esu
.
20
rtr fhehi;
eun arnet
}
INTERFACE

Finally, we want to show the data in a meaningful, sexy way...
DEMO
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJS and the Arduino for ngConf
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJS and the Arduino for ngConf
D3
aglrmdl(mAp)
nua.oue'yp'
.evc(D' fnto D( {rtr wno.3 }
srie'3, ucin 3)
eun idwd; )
.ietv(tmeaueag' fnto(3 {
drcie'eprtrGue, ucinD)
rtr {
eun
tmlt:'dvcas"hroee"<v>/v>/i>,
epae <i ls=temmtr>sg<sg<dv'
soe {'goe' ''}
cp:
nMdl: = ,
rsrc:'A,
etit E'
ln:fnto (cp,eeet ats {
ik ucin soe lmn, tr)
vre =D.eet'temmtr)
a l
3slc(.hroee',
w=atswdh| e.oe)cinWdh
tr.it | lnd(.letit,
h=atshih | e.oe)cinHih,
tr.egt | lnd(.letegt
r=Mt.i(,h /2
ahmnw )
,
p =Mt.I
i
ahP;
vrsg=e.eet'v'
a v
lslc(sg)
.tr'it' w
at(wdh, )
.tr'egt,h
at(hih' )
.ped''
apn(g)
.tr'rnfr' 'rnlt( +w2+''+h2+'';
at(tasom, tasae'
/
,
/
))
/ ..
/ .
}
}
;
};
)
LEARN MORE
THANKS

ARI LERNER, FULLSTACK.IO
Ad

More Related Content

What's hot (19)

The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
Edorian
 
Jpg2pdf
Jpg2pdfJpg2pdf
Jpg2pdf
fahmihid
 
The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
Edorian
 
Architecting Android Apps: Marko Gargenta
Architecting Android Apps: Marko GargentaArchitecting Android Apps: Marko Gargenta
Architecting Android Apps: Marko Gargenta
jaxconf
 
Ff to-fp
Ff to-fpFf to-fp
Ff to-fp
Andy Petrella
 
Marksheets of RKDwivedi
Marksheets of RKDwivediMarksheets of RKDwivedi
Marksheets of RKDwivedi
Raghvendra Dwivedi
 
Proposal
Proposal Proposal
Proposal
Brandon Nicholls
 
Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
Zumba Fitness - Technology Team
 
Cnc&amp;camshort answer questions 20161029 0002
Cnc&amp;camshort answer questions 20161029 0002Cnc&amp;camshort answer questions 20161029 0002
Cnc&amp;camshort answer questions 20161029 0002
Amar Parimi
 
Laporan keuangan tahun_2012-fin
Laporan keuangan tahun_2012-finLaporan keuangan tahun_2012-fin
Laporan keuangan tahun_2012-fin
Tiara Putri Adi Lestari
 
Introduction to JavaFX 2
Introduction to JavaFX 2Introduction to JavaFX 2
Introduction to JavaFX 2
Thierry Wasylczenko
 
Presenting Seq for Node.js
Presenting Seq for Node.jsPresenting Seq for Node.js
Presenting Seq for Node.js
Douglas Muth
 
EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)
EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)
EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)
MorarjiEr
 
Limit &amp; maxima
Limit &amp; maximaLimit &amp; maxima
Limit &amp; maxima
Zahidul Islam
 
AngularJS Testing
AngularJS TestingAngularJS Testing
AngularJS Testing
Eyal Vardi
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
zakiakhmad
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
Thierry Wasylczenko
 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation Process
Thomas Gregory
 
Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)
Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)
Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)
Self
 
The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
Edorian
 
The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
Edorian
 
Architecting Android Apps: Marko Gargenta
Architecting Android Apps: Marko GargentaArchitecting Android Apps: Marko Gargenta
Architecting Android Apps: Marko Gargenta
jaxconf
 
Cnc&amp;camshort answer questions 20161029 0002
Cnc&amp;camshort answer questions 20161029 0002Cnc&amp;camshort answer questions 20161029 0002
Cnc&amp;camshort answer questions 20161029 0002
Amar Parimi
 
Presenting Seq for Node.js
Presenting Seq for Node.jsPresenting Seq for Node.js
Presenting Seq for Node.js
Douglas Muth
 
EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)
EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)
EC8452-ELECTRONIC CIRCUITS II (Handwritten Notes)
MorarjiEr
 
AngularJS Testing
AngularJS TestingAngularJS Testing
AngularJS Testing
Eyal Vardi
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
zakiakhmad
 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation Process
Thomas Gregory
 
Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)
Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)
Islamic Lessons for children(বইঃ ইসলামী বাল্য শিক্ষা)
Self
 

Similar to How to create a 3.2 billion dollar business in 20 minutes: combining AngularJS and the Arduino for ngConf (20)

Flow of events during Media Player creation in Android
Flow of events during Media Player creation in AndroidFlow of events during Media Player creation in Android
Flow of events during Media Player creation in Android
Somenath Mukhopadhyay
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script apps
Eugene Zharkov
 
OOP in Rust
OOP in RustOOP in Rust
OOP in Rust
KENZ_gelsoft
 
JavaScript pitfalls
JavaScript pitfallsJavaScript pitfalls
JavaScript pitfalls
Claudio Cicali
 
Angular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental FeatureAngular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental Feature
Jonathan Magen
 
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJS
Adam Štipák
 
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play FrameworkSecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
jaliss
 
Java 8 - project lambda
Java 8 - project lambdaJava 8 - project lambda
Java 8 - project lambda
Ivar Østhus
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
Tony Fabeen
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
Tony Fabeen
 
C++11
C++11C++11
C++11
Sasha Goldshtein
 
Testing Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax ExamTesting Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax Exam
Henryk Konsek
 
Learn Frontend Testing
Learn Frontend TestingLearn Frontend Testing
Learn Frontend Testing
Ryan Roemer
 
Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
Lars Thorup
 
Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)
Corley S.r.l.
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!
Cédric Brun
 
nescala 2013
nescala 2013nescala 2013
nescala 2013
Hung Lin
 
Create Custom Post Type Plugin
Create Custom Post Type PluginCreate Custom Post Type Plugin
Create Custom Post Type Plugin
Jan Wilson
 
About Go
About GoAbout Go
About Go
Jongmin Kim
 
Introduction to ATS plugins
Introduction to ATS pluginsIntroduction to ATS plugins
Introduction to ATS plugins
PSUdaemon
 
Flow of events during Media Player creation in Android
Flow of events during Media Player creation in AndroidFlow of events during Media Player creation in Android
Flow of events during Media Player creation in Android
Somenath Mukhopadhyay
 
Creating windows store java script apps
Creating windows store java script appsCreating windows store java script apps
Creating windows store java script apps
Eugene Zharkov
 
Angular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental FeatureAngular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental Feature
Jonathan Magen
 
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJS
Adam Štipák
 
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play FrameworkSecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
jaliss
 
Java 8 - project lambda
Java 8 - project lambdaJava 8 - project lambda
Java 8 - project lambda
Ivar Østhus
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
Tony Fabeen
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
Tony Fabeen
 
Testing Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax ExamTesting Fuse Fabric with Pax Exam
Testing Fuse Fabric with Pax Exam
Henryk Konsek
 
Learn Frontend Testing
Learn Frontend TestingLearn Frontend Testing
Learn Frontend Testing
Ryan Roemer
 
Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
Lars Thorup
 
Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)Build a custom (micro)framework with ZF2 Components (as building blocks)
Build a custom (micro)framework with ZF2 Components (as building blocks)
Corley S.r.l.
 
Breathe life into your designer!
Breathe life into your designer!Breathe life into your designer!
Breathe life into your designer!
Cédric Brun
 
nescala 2013
nescala 2013nescala 2013
nescala 2013
Hung Lin
 
Create Custom Post Type Plugin
Create Custom Post Type PluginCreate Custom Post Type Plugin
Create Custom Post Type Plugin
Jan Wilson
 
Introduction to ATS plugins
Introduction to ATS pluginsIntroduction to ATS plugins
Introduction to ATS plugins
PSUdaemon
 
Ad

Recently uploaded (20)

Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
DNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in NepalDNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in Nepal
ICT Frame Magazine Pvt. Ltd.
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
ACE Aarhus - Team'25 wrap-up presentation
ACE Aarhus - Team'25 wrap-up presentationACE Aarhus - Team'25 wrap-up presentation
ACE Aarhus - Team'25 wrap-up presentation
DanielEriksen5
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)
Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)
Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)
Cyntexa
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
ACE Aarhus - Team'25 wrap-up presentation
ACE Aarhus - Team'25 wrap-up presentationACE Aarhus - Team'25 wrap-up presentation
ACE Aarhus - Team'25 wrap-up presentation
DanielEriksen5
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)
Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)
Why Slack Should Be Your Next Business Tool? (Tips to Make Most out of Slack)
Cyntexa
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Ad

How to create a 3.2 billion dollar business in 20 minutes: combining AngularJS and the Arduino for ngConf

  • 2. ARI LERNER, FULLSTACK.IO Author of ng-book and ng-newsletter Author of a few others (D3 on Angular, Riding Rails with AngularJS) Teacher at HackReactor Cofounder of Fullstack.io Background in distributed computing and infrastructure
  • 3. WHAT Let's prototype a temperature control system in less than 20 minutes using the Arduino, an open-source hardware platform and Angular
  • 5. OVERVIEW Running an HTTP server on the arduino Requesting the HTML from the arduino Loading angular app Communicating to Angular from the Arduino Communicating to the Arduino from Angular
  • 6. RUNNING AN HTTP SERVER An HTTP server written in C... it's hard...
  • 7. vi lo( { od op) / lse fricmn cins / itn o noig let EhreCin cin =sre.vial(; tentlet let evraalbe) i (let { f cin) wie(letcnetd) { hl cin.once() i (letaalbe) { f cin.vial() ca c=cin.ed) hr letra(; i ( = 'n & cretiesln){ f c = ' & urnLnIBak cin.rnl(HT/. 20O"; letpitn"TP11 0 K) cin.rnl(CnetTp:tx/tl) letpitn"otn-ye ethm"; cin.rnl(Cneto:coe) letpitn"oncin ls"; cin.rnl(; letpitn) cin.rnl(<1H fo teAdio/1"; letpitn"h>i rm h run<h>) bek ra; } i ( = 'n){cretiesln =tu;} f c = ' urnLnIBak re es i ( ! 'r){cretiesln =fle } le f c = ' urnLnIBak as; } } dly1; ea() cin.tp) letso(; } }
  • 8. ENTER TINYWEBSERVER Enables simplification of the c HTTP server code
  • 9. #nld <iyeSre.> icue TnWbevrh / Idxhnlr / ne ade boenidxhnlrTnWbevr wbsre){ ola ne_ade(iyeSre& e_evr wbsre.rn((<tl<ed<il>e sre<tte<ha>); e_evrpitF"hm>ha>tteWb evr/il>/ed") wbsre.rn((<oy<bd>/tl") e_evrpitF"bd>/oy<hm>); rtr tu; eun re } / Hnlr / ades TnWbevr:ahade hnlr[ ={ iyeSre:PtHnlr ades] {/isdgtl,TnWbevr:OT &iia_i_ade} "pn/iia" iyeSre:PS, dgtlpnhnlr, {/is,TnWbevr:E,&ishnlr, "pn" iyeSre:GT pn_ade} {/,TnWbevr:E,&ne_ade } "" iyeSre:GT idxhnlr , {UL, NL} } ; cntca*haes]={ os hr edr[ "otn-egh,"-cinLn,NL CnetLnt" XAto-e" UL } ; TnWbevrwb=TnWbevrhnlr,haes; iyeSre e iyeSre(ades edr) / .. / . vi lo( { od op) wbpoes) e.rcs(; } ;
  • 10. CONNECTING TO THE NET Ethernet shield Wifi shield #nld <tenth icue Ehre.> bt i[ ={12 18 0 6 } ye p] 9, 6, , 7 ; / .. / . Ehre.ei(a,i) tentbgnmc p; DHCP is also supported
  • 12. OPTIONS EMBED HTML IN ARDUINO READ/SEND FROM SD CARD LOAD FROM REMOTE SERVER
  • 13. cntca *OT="rdv90" os hr HS aie:00; / .. / . boenidxhnlrTnWbevr wbsre){ ola ne_ade(iyeSre& e_evr / .. / . wbsre.rn((<citi="psrp scht:/); e_evrpitF"srp dapcit" r="tp/") wbsre.rn(OT; e_evrpitHS) wbsre.rn((/cit/cit.s"<srp>); e_evrpitF"srpssrpsj>/cit") / .. / . } ;
  • 15. (ucin){ fnto( vrsrpTg=dcmn.eEeetBTgae'cit)0; a cita ouetgtlmnsyaNm(srp'[] / .. / . cetLnTg'tlsmi.s'; raeika(sye/ancs) vrar=[ a r 'cit/oue/run.s, srpsmdlsadioj' 'cit/p.s srpsapj' / .. / . ] ; cetSrpTg'oe_opnnsaglraglrj'; raecita(bwrcmoet/nua/nua.s) cetSrpTg'oe_opnnsaglrrueaglrruej'; raecita(bwrcmoet/nua-ot/nua-ot.s) arfrahfnto(r){cetSrpTgsc;}; r.oEc(ucinsc raecita(r) ) / Bosrp / otta bd.eAtiue'gap,'yp'; oysttrbt(n-p' mAp) vrap =dcmn.raelmn(dv) a p ouetcetEeet'i'; vrmi =dcmn.raelmn(dv) a an ouetcetEeet'i'; mi.eAtiue'anve' ') ansttrbt(mi-iw, '; apapnCidmi) p.pedhl(an; bd.pedhl(p) oyapnCidap; }(; ))
  • 16. COMMAND AND CONTROL Arduino -> Angular (√) Angular -> Arduino (...)
  • 17. EXPOSE THE LOCAL IP TO THE BROWSER boenidxhnlrTnWbevr wbsre){ ola ne_ade(iyeSre& e_evr / .. / . wbsre.rn((<citwno.p") e_evrpitF"srp>idwi="); wbsre.rn(pt_t(p) e_evrpiti_osri); wbsre.rn((<srp>); e_evrpitF""/cit") / .. / . } ;
  • 18. aglrmdl(fAdio,[) nua.oue'srun' ] .rvdr'run' fnto( { poie(Adio, ucin) ti.eRoUl=fnto(){ hsstotr ucinu roUl=u| roUl otr | otr; } ; ti.gt=fnto(ht){ hs$e ucin$tp rtr { eun gtis fnto( {, ePn: ucin) } stis fnto( { ePn: ucin) } } ; } }; ) aglrmdl(mAp,[ nua.oue'yp' 'srun' fAdio ] ) .ofgfnto(runPoie){ cni(ucinAdiorvdr Adiorvdrstotr(idwi) runPoie.eRoUlwno.p; }; )
  • 19. SUMMARY OF HARDWARE HACKING Turning pins on/HIGH Turning pins off/LOW Measuring pin voltage
  • 20. GETTING PIN STATUS / .. / . gtis fnto( { ePn: ucin) rtr $tp{ eun ht( mto:'E' ehd GT, ul roUl+'pn' r: otr /is }.hnfnto(aa { )te(ucindt) rtr dt.aa eun aadt; }; ) } , / .. / .
  • 21. SERVING PIN STATUS / GT/is / E pn boenpn_ade(iyeSre&wbsre){ ola ishnlrTnWbevr e_evr wbsre.ederrcd(0) e_evrsn_ro_oe20; wbsre.edcnettp(apiainjvsrp"; e_evrsn_otn_ye"plcto/aacit) wbsre.n_edr(; e_evredhaes) pnTSrn(e_evr; isotigwbsre) rtr tu; eun re } / .. / . bo pnTSrn(iyeSre&wbsre){ ol isotigTnWbevr e_evr wbsre < F"pn:"; e_evr < ({"is"[) itln=nmis n e uPn; friti0 iln i+{ o(n =; <e; +) wbsre < F"pn""; e_evr < ({"i:) wbsre < pn[]gti(; e_evr < isi.ePn) wbsre < F"vle""; e_evr < (,"au:) wbsre < pn[]gttt(; e_evr < isi.eSae) wbsre < F""; e_evr < (}) i (i1 <ln wbsre < F""; f (+) e) e_evr < (,) } wbsre < F"}) e_evr < (]"; rtr tu; eun re }
  • 22. MODIFYING PIN STATES Angular works with JSON by default (just javascript), but the Arduino does not... However, parsing a schemaless data structure in a strictly typed language is... difficult.
  • 23. CREATE OUR OWN PROTOCOL Turn JSON from: {pn 7 ato:'eTm'}(4bts i: , cin gtep 2 ye) to pa ( bts 70 4 ye)
  • 24. ACTIONS / i mive drcie / n aniw ietv Adiostis[ run.ePn( {pn tm,ato:'eTm'} i: ep cin gtep ]; ) / i Adiopoie / n run rvdr vratos={ a cin 'eTm' 0 gtep: } ; vratoiyis=fnto(is { a cinfPn ucinpn) vrsr='; a t ' fr(a i=0 i<pn.egh i+ { o vr ; islnt; +) vrp=pn[] a isi; sr+ ''+ppn t = p .i; i (yefpmd)!='neie' {t + ''+pmd; f tpo(.oe = udfnd) sr = m .oe} i (yefpvle !='neie' {t + ''+pvle} f tpo(.au) = udfnd) sr = v .au; i (yefpato)!='neie' {t + ''+atospato]} f tpo(.cin = udfnd) sr = a cin[.cin; } rtr sr eun t; } ;
  • 25. {pn 7 ato:'eTm'}(4bts i: , cin gtep 2 ye) to pa ( bts 70 4 ye)
  • 26. USING IT SERVICE stis fnto(is { ePn: ucinpn) vrsrcin=atoiyispn) a tAto cinfPn(is; rtr $tp{ eun ht( mto:'OT, ehd PS' ul roUl+'pn/iia' r: otr /isdgtl, dt:srcin aa tAto, haes {XAto-e' srcinlnt} edr: '-cinLn: tAto.egh }.hnfnto(aa { )te(ucindt) rtr dt.aa eun aadt; }; ) }
  • 27. PARSING IN C eu AtoTps{ nm cinye GTEP ETM } ; / PS /isdgtl / OT pn/iia boendgtlpnhnlrTnWbevr wbsre){ ola iia_i_ade(iyeSre& e_evr / Gtteato lnt / e h cin egh cntca*ato_t_e =wbsre.e_edrvle"-cinLn) os hr cinsrln e_evrgthae_au(XAto-e"; itln=ao(cinsrln; n e tiato_t_e) / Gtterqetdt bsdo telnt / e h eus aa ae n h egh ca*dt =(hr)alcln; hr aa ca*mlo(e) i (aa mme(aa 0 ln; f dt) estdt, , e) gtrqetdt(e_evr ln dt) e_eus_aawbsre, e, aa; / .. / . } ;
  • 28. CONTINUED itse =sre(aa; n Ln tlndt) iti=0 n ; wiei<se){ hl( Ln i (aai = '' { f dt[] = p) / W aepriganwpn / e r asn e i pnn =(n)dt[+]-''; iIt it(aa+i 0) Pn* =slc_i(iIt; i p eetpnpnn) wiedt[+]! ''& i<se){ hl(aai+ = p & Ln / W'ei apnojc / er n i bet sic (aai){ wth dt[] cs '' ae a: i+ +; atoIt=(n)dt[]-''; cinn it(aai 0) atoT=(cinye)atoIt; cin AtoTps(cinn) sic (cin){ wth atoT cs GTEP ae ETM: crTm =gtepd) urep eTm(s; p>eCretau(urep; -sturnVlecrTm) bek ra; / .. / .
  • 29. fotgtepOeiesno) la eTm(nWr esr{ /rtrstetmeauefo oeD1S0i DGClis /eun h eprtr rm n S82 n E esu bt dt[2,ad[] ye aa1] dr8; fotclis fhehi; la esu, arnet sno.erhad) esrsac(dr; sno.ee(; esrrst) sno.eetad) esrslc(dr; sno.rt(x41; esrwie04,) dly10) ea(00; bt peet=sno.ee(; ye rsn esrrst) sno.eetad) esrslc(dr; sno.rt(xE; esrwie0B) fr(n i=0 i<9 i+ {dt[]=sno.ed) } o it ; ; +) aai esrra(; sno.ee_erh) esrrstsac(; bt MB=dt[] ye S aa1; bt LB=dt[] ye S aa0; it6trw=(aa1 < 8 |dt[] rw=rw< 3 n1_ a dt[] < ) aa0; a a < ; i (aa7 = 01){rw=(a &0FF)+1 -dt[] } f dt[] = x0 a rw xF0 2 aa6; clis=(la)a /1.; esu fotrw 60 fhehi =clis*18+3.; arnet esu . 20 rtr fhehi; eun arnet }
  • 30. INTERFACE Finally, we want to show the data in a meaningful, sexy way...
  • 31. DEMO
  • 34. D3
  • 35. aglrmdl(mAp) nua.oue'yp' .evc(D' fnto D( {rtr wno.3 } srie'3, ucin 3) eun idwd; ) .ietv(tmeaueag' fnto(3 { drcie'eprtrGue, ucinD) rtr { eun tmlt:'dvcas"hroee"<v>/v>/i>, epae <i ls=temmtr>sg<sg<dv' soe {'goe' ''} cp: nMdl: = , rsrc:'A, etit E' ln:fnto (cp,eeet ats { ik ucin soe lmn, tr) vre =D.eet'temmtr) a l 3slc(.hroee', w=atswdh| e.oe)cinWdh tr.it | lnd(.letit, h=atshih | e.oe)cinHih, tr.egt | lnd(.letegt r=Mt.i(,h /2 ahmnw ) , p =Mt.I i ahP; vrsg=e.eet'v' a v lslc(sg) .tr'it' w at(wdh, ) .tr'egt,h at(hih' ) .ped'' apn(g) .tr'rnfr' 'rnlt( +w2+''+h2+''; at(tasom, tasae' / , / )) / .. / . } } ; }; )
  翻译: