SlideShare a Scribd company logo
1 of 31
Download to read offline
Taking Your “Web” App 
To places you never expected 
Garth Williams 
@williamsgarth 
IAEA 
International Atomic Energy Agency
IAEA 
Introduction 
IAEA Headquarters in Vienna 
http://iaea.org
IAEA 
Background 
• The IAEA inspects nuclear facilities all over the world 
• The IAEA is currently modernising a number of legacy applications 
• Our inspectors need to collect and store data where no network 
connection is guaranteed or even allowed 
• Our team is writing the next version of software for facility inspections
IAEA 
Let’s use WPF? 
• A desktop app is the logical choice, right? 
• Organisation standards are based on Microsoft technologies 
• So Windows Presentation Foundation must be the right choice? 
• (Oh, by the way, we may need to support tablets in 2015)
IAEA 
Why HTML(5) is better 
• HTML5 includes all the building blocks for offline apps 
• Web apps don’t need to be installed 
• HTML is portable
IAEA 
Ember is a good fit 
• Full stack framework 
• Well suited to larger projects: 
• Ember offers familiar conventions 
• Ember encourages consistency and structure through the 
use of components, ember data, stateful routing, etc… 
• Compiles down to one or two js distributables
IAEA 
Taking ember offline 
(manifest.appcache) 
• Use a manifest file 
• Lists all resources needed when offline 
• CSS, Fonts, Images, JavaScript, HTML, etc… 
• Referenced in your html tag 
<!DOCTYPE*html>* 
<html*manifest=“/manifest.appcache”>* 
**…* 
</html>
IAEA 
Taking ember offline 
(manifest.appcache) 
CACHE*MANIFEST* 
#-Version-1.0.0- 
! 
CACHE:* 
/js/app.js* 
/css/app.css* 
/images/logo.png* 
/fonts/fontawesomeJwebfont.woff* 
/404.html* 
! 
NETWORK:* 
/api* 
! 
FALLBACK:* 
/*/404.html
IAEA 
What about my beautiful 
client side URLs? 
• Single page apps used to use # for client side routing 
• For an app is located at 
• https://stunningapp.com/ 
• When the client navigates to entity 5 then we can have 
• https://stunningapp.com/#/entity/5
IAEA 
What about my beautiful 
client side URLs? 
• But now I’m using push state, how can this dynamic url be 
available offline? 
• https://stunningapp.com/entity/5/
IAEA 
What about my beautiful 
client side URLs? 
• Use the FALLBACK section of the manifest file 
CACHE*MANIFEST* 
! 
CACHE:* 
/* 
! 
FALLBACK:* 
#-normal-fallback:-/-/404.html- 
#-Support-Push-State- 
/*/ 
• Any page not stored locally will return the cached root page
IAEA 
Caching hell 
& double reloads 
• First time a browser visits your app: 
1. HTML is downloaded 
2. Manifest is detected and downloaded 
3. Resources listed in manifest are downloaded and stored
IAEA 
Caching hell 
& double reloads 
• On subsequent visits: 
1. Cached version of all app files are used 
• Fast load time! 
• Potentially out of date! 
2. Check if manifest file has changed
IAEA 
Caching hell 
& double reloads 
• Manifest is only checked on first load 
• Long running apps won’t know there’s a new version 
• Only the manifest file is checked 
• Changes in other files will not be detected 
• If there is a new version it will be silently downloaded 
• User is not automatically informed 
• Changes are not applied until reload
IAEA 
Caching hell 
& double reloads 
• Mitigation: 
1. Auto-generate the manifest 
• Put a content hash of cached files in a comment 
CACHE*MANIFEST* 
! 
CACHE:* 
#-app.js-hash:-1921ec2e922f7f11c73c870e908b1c50- 
/js/app.js
IAEA 
Caching hell 
& double reloads 
• Mitigation: 
2. Notify the user 
applicationCache.addEventListener('updateready',*function*()*{* 
**//*let*the*user*know*that*they*need*to*reload* 
});
IAEA 
Caching hell 
& double reloads 
• During development you may spend a lot of time reloading the app 
• 1 reload is not enough 
• 1st reload will download the changes 
• 2nd will put them into effect 
• 2 reloads is tedious 
• If you reload too quickly it might not work
IAEA 
Caching hell 
& double reloads 
• Mitigation: 
3. Periodically check for a new version 
setInterval(function*()*{* 
**applicationCache.update();* 
},*config.newVersionCheckInterval); 
• If the manifest has changed then it will be downloaded in the 
background
IAEA 
Toggle online only features 
• Some features require a server 
• We can check network connection status 
• Also need to check if the server can be reached
IAEA 
Toggle online only features 
• Detecting network availability 
var*updateNetworkStatus*=*function*()*{* 
**if*(applicationController.get('isNetworkConnected')*!==*navigator.onLine)*{* 
****applicationController.set('isNetworkConnected',*navigator.onLine);* 
****//*if*we*just*moved*from*offline*to*online*check*for*app*update* 
****if*(navigator.onLine)*{* 
******applicationCache.update();* 
****}* 
**}* 
};* 
window.addEventListener('online',*updateNetworkStatus);* 
window.addEventListener('offline',*updateNetworkStatus);
IAEA 
Toggle online only features 
• Detecting service availability 
var*updateServiceStatus*=*function*(status)*{* 
**applicationController.set('isServiceAvailable',*status.type*!==*'error');* 
};* 
! 
applicationCache.addEventListener('error',*updateServiceStatus);* 
applicationCache.addEventListener('noupdate',*updateServiceStatus);* 
applicationCache.addEventListener('updateready',*updateServiceStatus);
IAEA 
Toggle online only features 
• Putting network and service status together 
isOnline:*function*()*{* 
**return*this.get('isNetworkConnected')*&&*this.get('isServiceAvailable');* 
}.property('isNetworkConnected',*'isServiceAvailable')
IAEA 
Data Access 
• Ember data offers useful layered abstractions 
• An adaptor lets you communicate with your data source 
• A serialiser lets you transform from the format of your source to the 
format expected by ember 
• The store provides an agnostic API for application to load and save 
models
IAEA 
Data Access 
• Server side we’re using ASP.NET MVC Web API 
• Requires a custom Adaptor and Serialiser 
• Adding offline support at the adaptor level is easy 
• Application code does not need know
IAEA 
Data Access 
• Oversimplified data adaptor 
var*CacheAdapter*=*DS.RESTAdapter.extend({* 
**ajax:*function*(url,*type,*options)*{* 
****if*(App.get('isOnline'))*{* 
******options.success*=*function*(responseData)*{* 
********cacheResponse(url,*type,*options,*responseData);* 
******};* 
******return*this._super(url,*type,*options);* 
****}*else*{* 
******return*cachedResponse(url,*type,*options);* 
****}* 
**}* 
});
IAEA 
Data Access 
• Not always desirable to cache every response 
• Pass intentions to store methods
IAEA 
Data Access 
store.findById('person',*id,*{*cacheResponse:*true*}); 
var*CacheStore*=*DS.Store.extend({* 
**findById:*function*(type,*id,*options)*{* 
****return*this.findQuery(type,*{*id:*id*},*options).then(function*(result)*{* 
******return*result.get('firstObject');* 
****});* 
**},* 
! 
**findQuery:*function*(type,*data,*options)*{* 
****data*=*data*||*{};* 
****data.__options*=*options*||*{};* 
****return*this._super(type,*data);* 
**}* 
});
IAEA 
Hold on… “new” requirement 
• We forgot to mention… 
• Sometimes it’s not possible to bring the laptop/tablet back to 
headquarters 
• How can you deploy and update a web app to a computer that never 
connects to the server?
IAEA 
Hold on… “new” requirement 
• At a small number of locations, the only hardware allowed back to 
HQ is a hardware encrypted USB stick… 
• Put the browser on the USB stick 
• Configure the browser to store all data cache data on the USB 
• Now when at HQ the browser will update the app and store data 
needed ready for offline use
IAEA 
Recap 
• Ember offers the structure necessary for large (and small) projects 
• Build tools like ember-cli give you manageable output for 
manifest.appcache and can easily be extended to automate its content 
• Build automation is essential from the start when using appcache 
• Ember data has the abstractions necessary to provide good offline 
support which can be transparent to your app 
• There’s not much that you can’t do with Ember.js “web” application
IAEA 
Questions?

More Related Content

What's hot

White paper mbre_en
White paper mbre_enWhite paper mbre_en
White paper mbre_enVisioneerUG
 
How to customize Spring Boot?
How to customize Spring Boot?How to customize Spring Boot?
How to customize Spring Boot?GilWon Oh
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservicesseges
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring BootTrey Howard
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootJosué Neis
 
NLOUG 2017- Oracle WebCenter Portal 12c Performance
NLOUG 2017- Oracle WebCenter Portal 12c PerformanceNLOUG 2017- Oracle WebCenter Portal 12c Performance
NLOUG 2017- Oracle WebCenter Portal 12c PerformanceDaniel Merchán García
 
Microservice test strategies for applications based on Spring, K8s and Istio
Microservice test strategies for applications based on Spring, K8s and IstioMicroservice test strategies for applications based on Spring, K8s and Istio
Microservice test strategies for applications based on Spring, K8s and IstioAhmed Misbah
 
Java springboot microservice - Accenture Technology Meetup
Java springboot microservice - Accenture Technology MeetupJava springboot microservice - Accenture Technology Meetup
Java springboot microservice - Accenture Technology MeetupAccenture Hungary
 
O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...Satya Harish
 
Deployment automation framework with selenium
Deployment automation framework with seleniumDeployment automation framework with selenium
Deployment automation framework with seleniumWenhua Wang
 
IIS interview questions and answers
IIS interview questions and answersIIS interview questions and answers
IIS interview questions and answersInterviewwiz
 
AFNetworking
AFNetworking AFNetworking
AFNetworking joaopmaia
 
Performance Testing in Oracle Apps
Performance Testing in Oracle AppsPerformance Testing in Oracle Apps
Performance Testing in Oracle AppsBiswajit Pratihari
 

What's hot (20)

White paper mbre_en
White paper mbre_enWhite paper mbre_en
White paper mbre_en
 
Spring boot
Spring bootSpring boot
Spring boot
 
How to customize Spring Boot?
How to customize Spring Boot?How to customize Spring Boot?
How to customize Spring Boot?
 
Ready! Steady! SpringBoot!
Ready! Steady! SpringBoot! Ready! Steady! SpringBoot!
Ready! Steady! SpringBoot!
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
When Camel Smiles
When Camel SmilesWhen Camel Smiles
When Camel Smiles
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
NLOUG 2017- Oracle WebCenter Portal 12c Performance
NLOUG 2017- Oracle WebCenter Portal 12c PerformanceNLOUG 2017- Oracle WebCenter Portal 12c Performance
NLOUG 2017- Oracle WebCenter Portal 12c Performance
 
Microservice test strategies for applications based on Spring, K8s and Istio
Microservice test strategies for applications based on Spring, K8s and IstioMicroservice test strategies for applications based on Spring, K8s and Istio
Microservice test strategies for applications based on Spring, K8s and Istio
 
Oracle application testing suite online training
Oracle application testing suite online trainingOracle application testing suite online training
Oracle application testing suite online training
 
NLOUG 2018 - Future of JSF and ADF
NLOUG 2018 - Future of JSF and ADFNLOUG 2018 - Future of JSF and ADF
NLOUG 2018 - Future of JSF and ADF
 
Java springboot microservice - Accenture Technology Meetup
Java springboot microservice - Accenture Technology MeetupJava springboot microservice - Accenture Technology Meetup
Java springboot microservice - Accenture Technology Meetup
 
O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...
 
Deployment automation framework with selenium
Deployment automation framework with seleniumDeployment automation framework with selenium
Deployment automation framework with selenium
 
Asp.net control
Asp.net controlAsp.net control
Asp.net control
 
IIS interview questions and answers
IIS interview questions and answersIIS interview questions and answers
IIS interview questions and answers
 
Real-World Load Testing of ADF Fusion Applications Demonstrated - Oracle Ope...
Real-World Load Testing of ADF Fusion Applications Demonstrated  - Oracle Ope...Real-World Load Testing of ADF Fusion Applications Demonstrated  - Oracle Ope...
Real-World Load Testing of ADF Fusion Applications Demonstrated - Oracle Ope...
 
AFNetworking
AFNetworking AFNetworking
AFNetworking
 
Performance Testing in Oracle Apps
Performance Testing in Oracle AppsPerformance Testing in Oracle Apps
Performance Testing in Oracle Apps
 

Similar to Taking your “web” app to places you never expected - Ember Fest 2014

Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Pavel Chunyayev
 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Ryan Cuprak
 
Apache Cordova phonegap plugins for mobile app development
Apache Cordova phonegap plugins for mobile app developmentApache Cordova phonegap plugins for mobile app development
Apache Cordova phonegap plugins for mobile app developmentwebprogr.com
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentEngin Hatay
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsPablo Godel
 
Build Database Applications for SharePoint
Build Database Applications for SharePointBuild Database Applications for SharePoint
Build Database Applications for SharePointIron Speed
 
Build Database Applications for SharePoint!
Build Database Applications for SharePoint!Build Database Applications for SharePoint!
Build Database Applications for SharePoint!Iron Speed
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM iZend by Rogue Wave Software
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartEric Overfield
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteorSapna Upreti
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performanceEngine Yard
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsmichaelaaron25322
 

Similar to Taking your “web” app to places you never expected - Ember Fest 2014 (20)

XPages Mobile, #dd13
XPages Mobile, #dd13XPages Mobile, #dd13
XPages Mobile, #dd13
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015
 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
 
Apache Cordova phonegap plugins for mobile app development
Apache Cordova phonegap plugins for mobile app developmentApache Cordova phonegap plugins for mobile app development
Apache Cordova phonegap plugins for mobile app development
 
SamSegalResume
SamSegalResumeSamSegalResume
SamSegalResume
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
 
Build Database Applications for SharePoint
Build Database Applications for SharePointBuild Database Applications for SharePoint
Build Database Applications for SharePoint
 
Build Database Applications for SharePoint!
Build Database Applications for SharePoint!Build Database Applications for SharePoint!
Build Database Applications for SharePoint!
 
Apache cordova
Apache cordovaApache cordova
Apache cordova
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Intro to PhoneGap
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Sam segal resume
Sam segal resumeSam segal resume
Sam segal resume
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework Webpart
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
 

Recently uploaded

Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...OnePlan Solutions
 
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with GraphGraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with GraphNeo4j
 
The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)Roberto Bettazzoni
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbankkasambamuno
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaNeo4j
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Maxim Salnikov
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024MulesoftMunichMeetup
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfICS
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...drm1699
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio, Inc.
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksJinanKordab
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMarkus Moeller
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit MilanNeo4j
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfWSO2
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Henry Schreiner
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Chirag Panchal
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AIAGATSoftware
 
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypseTomasz Kowalczewski
 

Recently uploaded (20)

Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
 
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with GraphGraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
 
The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
^Clinic ^%[+27788225528*Abortion Pills For Sale In witbank
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with Links
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdf
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
 

Taking your “web” app to places you never expected - Ember Fest 2014

  • 1. Taking Your “Web” App To places you never expected Garth Williams @williamsgarth IAEA International Atomic Energy Agency
  • 2. IAEA Introduction IAEA Headquarters in Vienna http://iaea.org
  • 3. IAEA Background • The IAEA inspects nuclear facilities all over the world • The IAEA is currently modernising a number of legacy applications • Our inspectors need to collect and store data where no network connection is guaranteed or even allowed • Our team is writing the next version of software for facility inspections
  • 4. IAEA Let’s use WPF? • A desktop app is the logical choice, right? • Organisation standards are based on Microsoft technologies • So Windows Presentation Foundation must be the right choice? • (Oh, by the way, we may need to support tablets in 2015)
  • 5. IAEA Why HTML(5) is better • HTML5 includes all the building blocks for offline apps • Web apps don’t need to be installed • HTML is portable
  • 6. IAEA Ember is a good fit • Full stack framework • Well suited to larger projects: • Ember offers familiar conventions • Ember encourages consistency and structure through the use of components, ember data, stateful routing, etc… • Compiles down to one or two js distributables
  • 7. IAEA Taking ember offline (manifest.appcache) • Use a manifest file • Lists all resources needed when offline • CSS, Fonts, Images, JavaScript, HTML, etc… • Referenced in your html tag <!DOCTYPE*html>* <html*manifest=“/manifest.appcache”>* **…* </html>
  • 8. IAEA Taking ember offline (manifest.appcache) CACHE*MANIFEST* #-Version-1.0.0- ! CACHE:* /js/app.js* /css/app.css* /images/logo.png* /fonts/fontawesomeJwebfont.woff* /404.html* ! NETWORK:* /api* ! FALLBACK:* /*/404.html
  • 9. IAEA What about my beautiful client side URLs? • Single page apps used to use # for client side routing • For an app is located at • https://stunningapp.com/ • When the client navigates to entity 5 then we can have • https://stunningapp.com/#/entity/5
  • 10. IAEA What about my beautiful client side URLs? • But now I’m using push state, how can this dynamic url be available offline? • https://stunningapp.com/entity/5/
  • 11. IAEA What about my beautiful client side URLs? • Use the FALLBACK section of the manifest file CACHE*MANIFEST* ! CACHE:* /* ! FALLBACK:* #-normal-fallback:-/-/404.html- #-Support-Push-State- /*/ • Any page not stored locally will return the cached root page
  • 12. IAEA Caching hell & double reloads • First time a browser visits your app: 1. HTML is downloaded 2. Manifest is detected and downloaded 3. Resources listed in manifest are downloaded and stored
  • 13. IAEA Caching hell & double reloads • On subsequent visits: 1. Cached version of all app files are used • Fast load time! • Potentially out of date! 2. Check if manifest file has changed
  • 14. IAEA Caching hell & double reloads • Manifest is only checked on first load • Long running apps won’t know there’s a new version • Only the manifest file is checked • Changes in other files will not be detected • If there is a new version it will be silently downloaded • User is not automatically informed • Changes are not applied until reload
  • 15. IAEA Caching hell & double reloads • Mitigation: 1. Auto-generate the manifest • Put a content hash of cached files in a comment CACHE*MANIFEST* ! CACHE:* #-app.js-hash:-1921ec2e922f7f11c73c870e908b1c50- /js/app.js
  • 16. IAEA Caching hell & double reloads • Mitigation: 2. Notify the user applicationCache.addEventListener('updateready',*function*()*{* **//*let*the*user*know*that*they*need*to*reload* });
  • 17. IAEA Caching hell & double reloads • During development you may spend a lot of time reloading the app • 1 reload is not enough • 1st reload will download the changes • 2nd will put them into effect • 2 reloads is tedious • If you reload too quickly it might not work
  • 18. IAEA Caching hell & double reloads • Mitigation: 3. Periodically check for a new version setInterval(function*()*{* **applicationCache.update();* },*config.newVersionCheckInterval); • If the manifest has changed then it will be downloaded in the background
  • 19. IAEA Toggle online only features • Some features require a server • We can check network connection status • Also need to check if the server can be reached
  • 20. IAEA Toggle online only features • Detecting network availability var*updateNetworkStatus*=*function*()*{* **if*(applicationController.get('isNetworkConnected')*!==*navigator.onLine)*{* ****applicationController.set('isNetworkConnected',*navigator.onLine);* ****//*if*we*just*moved*from*offline*to*online*check*for*app*update* ****if*(navigator.onLine)*{* ******applicationCache.update();* ****}* **}* };* window.addEventListener('online',*updateNetworkStatus);* window.addEventListener('offline',*updateNetworkStatus);
  • 21. IAEA Toggle online only features • Detecting service availability var*updateServiceStatus*=*function*(status)*{* **applicationController.set('isServiceAvailable',*status.type*!==*'error');* };* ! applicationCache.addEventListener('error',*updateServiceStatus);* applicationCache.addEventListener('noupdate',*updateServiceStatus);* applicationCache.addEventListener('updateready',*updateServiceStatus);
  • 22. IAEA Toggle online only features • Putting network and service status together isOnline:*function*()*{* **return*this.get('isNetworkConnected')*&&*this.get('isServiceAvailable');* }.property('isNetworkConnected',*'isServiceAvailable')
  • 23. IAEA Data Access • Ember data offers useful layered abstractions • An adaptor lets you communicate with your data source • A serialiser lets you transform from the format of your source to the format expected by ember • The store provides an agnostic API for application to load and save models
  • 24. IAEA Data Access • Server side we’re using ASP.NET MVC Web API • Requires a custom Adaptor and Serialiser • Adding offline support at the adaptor level is easy • Application code does not need know
  • 25. IAEA Data Access • Oversimplified data adaptor var*CacheAdapter*=*DS.RESTAdapter.extend({* **ajax:*function*(url,*type,*options)*{* ****if*(App.get('isOnline'))*{* ******options.success*=*function*(responseData)*{* ********cacheResponse(url,*type,*options,*responseData);* ******};* ******return*this._super(url,*type,*options);* ****}*else*{* ******return*cachedResponse(url,*type,*options);* ****}* **}* });
  • 26. IAEA Data Access • Not always desirable to cache every response • Pass intentions to store methods
  • 27. IAEA Data Access store.findById('person',*id,*{*cacheResponse:*true*}); var*CacheStore*=*DS.Store.extend({* **findById:*function*(type,*id,*options)*{* ****return*this.findQuery(type,*{*id:*id*},*options).then(function*(result)*{* ******return*result.get('firstObject');* ****});* **},* ! **findQuery:*function*(type,*data,*options)*{* ****data*=*data*||*{};* ****data.__options*=*options*||*{};* ****return*this._super(type,*data);* **}* });
  • 28. IAEA Hold on… “new” requirement • We forgot to mention… • Sometimes it’s not possible to bring the laptop/tablet back to headquarters • How can you deploy and update a web app to a computer that never connects to the server?
  • 29. IAEA Hold on… “new” requirement • At a small number of locations, the only hardware allowed back to HQ is a hardware encrypted USB stick… • Put the browser on the USB stick • Configure the browser to store all data cache data on the USB • Now when at HQ the browser will update the app and store data needed ready for offline use
  • 30. IAEA Recap • Ember offers the structure necessary for large (and small) projects • Build tools like ember-cli give you manageable output for manifest.appcache and can easily be extended to automate its content • Build automation is essential from the start when using appcache • Ember data has the abstractions necessary to provide good offline support which can be transparent to your app • There’s not much that you can’t do with Ember.js “web” application