This document provides an overview of the Meteor JavaScript web application framework. It discusses key Meteor concepts like Blaze for creating reactive UIs, Tracker for transparent reactive programming, and data contexts that are set implicitly through template tags and passed between templates. The document also covers Spacebars templating syntax and how data contexts work in templates, template helpers, and with Iron Router.
A brief introduction to how to change architecture patterns for use in cloud computing and avoid the pitfalls of replicating your data centre like for like in the cloud.
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland HochmuthNETWAYS
Roland Hochmut ist der Project Tech Lead (PTL) und Software Architect bei Monasca, das Open –Source Monitoring-as-a-Service (at-Scale) OpenStack Project (https://wiki.openstack.org/wiki/Monasca). Er konzentriert sich auf die Entwicklung einer leistungsstarken, skalierbaren und zuverlässigen Turn-Key Monitoring Lösung, die Einfluss hat auf die leitenden Trends und Innovationen der Industrie was Streaming von Daten, Analyse und Big Data betrifft. Er ist auch verantwortlich für die Metrics Processing Pipeline für HP`s öffentliche Cloud. Er hat Erfahrung in mehreren Software-Bereichen und Domänen, sowohl von 3-D Computer Grafiken als auch von Remote Desktop Visualisierung und Cloud Computing und Monitoring.
A brief introduction to how to change architecture patterns for use in cloud computing and avoid the pitfalls of replicating your data centre like for like in the cloud.
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland HochmuthNETWAYS
Roland Hochmut ist der Project Tech Lead (PTL) und Software Architect bei Monasca, das Open –Source Monitoring-as-a-Service (at-Scale) OpenStack Project (https://wiki.openstack.org/wiki/Monasca). Er konzentriert sich auf die Entwicklung einer leistungsstarken, skalierbaren und zuverlässigen Turn-Key Monitoring Lösung, die Einfluss hat auf die leitenden Trends und Innovationen der Industrie was Streaming von Daten, Analyse und Big Data betrifft. Er ist auch verantwortlich für die Metrics Processing Pipeline für HP`s öffentliche Cloud. Er hat Erfahrung in mehreren Software-Bereichen und Domänen, sowohl von 3-D Computer Grafiken als auch von Remote Desktop Visualisierung und Cloud Computing und Monitoring.
Zach Shelby, Director of Technology for IoT at ARM and previously the co-founder of Sensinode gives and an in-depth tutrorial of the Constrained Application Protocol (CoAP) for the Internet of Things. Updates to this tutorial made on April 30th, 2014.
The Cisco Open SDN Controller is a commercial distribution of OpenDaylight that delivers business agility through automation of standards-based network infrastructure.
Built as a highly scalable software-defined networking (SDN) platform, the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
The controller exposes REST APIs to allow other applications to take advantage capabilities of the controller and unlock the power of the underlying network infrastructure, and JAVA APIs to allow for the creation of new network services.
This session will present the basic constructs of the controller and the capabilities of the REST and JAVA APIs to demonstrate how the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
Topics covered in this presentation are Principles of network applications, Web and HTTP, FTP ,Electronic mail, SMTP, POP3, IMAP, DNS, P2P applications, Socket programming with UDP and TCP
Jan Lindblad's presentation at Layer123 SDN and OpenFlow World Congress in Bad Homburg, Germany. Focusing on a multi-vendor SDN deployment at a Tier 1 Service Provider in Asia.
Tail-f Network Control System (NCS) use case:
• Dynamic control of L3-L7 devices using service- oriented network API
• Service chaining using OpenFlow
• Virtualized appliances
Netty Notes Part 2 - Transports and BuffersRick Hightower
Continues on from Part 1 of Netty Notes which covered an overview of Netty concepts. Dives into transports and buffer usage, and why Netty matters for performance.
Topics covered are Introduction and Transport-Layer Services
Multiplexing and De-multiplexing, Connection less Transport: UDP,Principles of Reliable Data Transfer,Connection-Oriented Transport: TCP, Principles of Congestion Control, TCP Congestion Control
Zach Shelby, Director of Technology for IoT at ARM and previously the co-founder of Sensinode gives and an in-depth tutrorial of the Constrained Application Protocol (CoAP) for the Internet of Things. Updates to this tutorial made on April 30th, 2014.
The Cisco Open SDN Controller is a commercial distribution of OpenDaylight that delivers business agility through automation of standards-based network infrastructure.
Built as a highly scalable software-defined networking (SDN) platform, the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
The controller exposes REST APIs to allow other applications to take advantage capabilities of the controller and unlock the power of the underlying network infrastructure, and JAVA APIs to allow for the creation of new network services.
This session will present the basic constructs of the controller and the capabilities of the REST and JAVA APIs to demonstrate how the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
Topics covered in this presentation are Principles of network applications, Web and HTTP, FTP ,Electronic mail, SMTP, POP3, IMAP, DNS, P2P applications, Socket programming with UDP and TCP
Jan Lindblad's presentation at Layer123 SDN and OpenFlow World Congress in Bad Homburg, Germany. Focusing on a multi-vendor SDN deployment at a Tier 1 Service Provider in Asia.
Tail-f Network Control System (NCS) use case:
• Dynamic control of L3-L7 devices using service- oriented network API
• Service chaining using OpenFlow
• Virtualized appliances
Netty Notes Part 2 - Transports and BuffersRick Hightower
Continues on from Part 1 of Netty Notes which covered an overview of Netty concepts. Dives into transports and buffer usage, and why Netty matters for performance.
Topics covered are Introduction and Transport-Layer Services
Multiplexing and De-multiplexing, Connection less Transport: UDP,Principles of Reliable Data Transfer,Connection-Oriented Transport: TCP, Principles of Congestion Control, TCP Congestion Control
Managing dependencies in OSGi using the Apache Felix Dependency Manager gives you some powerful tools for expressing and managing all kinds of dependencies between components. This presentation shows you how to use them, and explains what design patterns are available for building applications. It also shows how to extend this system with custom types of dependencies.
Keynote at COMMitMDE'18 showing the basic concepts behind Hawk, our past case studies, and some of our experience in designing the Hawk Thrift APIs for remote model querying.
The world is moving from a model where data sits at rest, waiting for people to make requests of it, to where data is constantly moving, streams of data flow to and from devices with or without human interaction. Decisions need to be made based on these streams of data in real time, models need to be updated, intelligence needs to be learned. And our old-fashioned approach of CRUD REST APIs serving CRUD database calls just doesn't cut it, it's trying to fit a square peg into a round hole. It's time we moved to a stream-centric view of the world.
This talk will look at how Reactive Streams is shaping the future of Jakarta EE. I'll talk about some Reactive Streams based specifications that we're currently working on in the JDK, MicroProfile and Jakarta EE communities, as well as some potential big ideas to transform the way developers write their applications, such as event sourcing and CQRS, that Jakarta EE will likely adopt in future. We'll take a look at a hypothetical future Jakarta EE, at what a typical service will look like when streaming is embraced, and get a glimpse of how Jakarta EE can lead the world in standards for Reactive systems.
The world is moving from a model where data sits at rest, waiting for people to make requests of it, to where data is constantly moving and streams of data flow to and from devices with or without human interaction. Decisions need to be made based on these streams of data in real-time, models need to be updated, and intelligence needs to be gathered. In this context, our old-fashioned approach of CRUD REST APIs serving CRUD database calls just doesn't cut it. It's time we moved to a stream-centric view of the world.
The world is moving from a model where data sits at rest, waiting for people to make requests of it, to where data is constantly moving and streams of data flow to and from devices with or without human interaction. Decisions need to be made based on these streams of data in real-time, models need to be updated, and intelligence needs to be gathered. In this context, our old-fashioned approach of CRUD REST APIs serving CRUD database calls just doesn't cut it. It's time we moved to a stream-centric view of the world.
https://jonthebeach.com/speakers/71/Markus+Eisele
Devops core principles
CI/CD basics
CI/CD with asp.net core webapi and Angular app
Iac Why and What?
Demo using Azure and Azure Devops
Docker why and what ?
Demo using Azure and Azure Devops
Kubernetes why and what?
Demo using Azure and Azure Devops
Тема доклада «React и его архитектурная периферия»
React - мощнейшая библиотека для создания технических интерфейсов, но порой одного реакта не достаточно для полноценной и гибкой разработки. Мы будем обсуждать и сравнивать разные подходы для разработки современных React приложений.
В программе: React&Redux, React&Meteor, React&Relay, React&MobX, React&PRPL
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
2. Attribution
• The material contained inside is intended for teaching.
• This document is licensed under the CC BY-NC-SA license.
• Relevant sources are listed on the following References slide.
• All figures and text borrowed from these sources retain the rights of
their respective owners.
2/56
3. References
• Websites
• Official website
• Meteor on Twitter
• Meteor on GitHub
• Meteor on StackOverflow
• forums.meteor.com - Meteor discussion forums
• crater.io - Meteor News
• Books
• Turnbull, David - Your First Meteor Application (2014)
• Coleman, Tom; Greif, Sacha - Discover Meteor (2014)
• Hochhaus, Stephan; Schoebel, Manuel - Meteor in Action (2014)
• Susiripala, Arunoda - Bulletproof Meteor (2014)
• Susiripala, Arunoda - Meteor Explained - A Journey Into Meteor’s Reactivity (2014)
• Strack, Isaac - Getting started with Meteor.js JavaScript framework (2012)
• http://meteorcapture.com/
3/56
4. Acknowledgments & Warning
• Special thanks to all the authors of the documents cited in the
references for their high-quality teaching material from which I have
borrowed extensively.
• This material has been written in late 2015 and as Meteor is a fast
moving target, some parts may be outdated.
4/56
5. Table of Contents
1. Presentation
2. Principles
3. Templates
4. Sessions
5. Spacebars
6. Data contexts
7. Routing with Iron Router
8. Modules & packages
9. Misc
5/56
7. Meteor
• Open-source JavaScript web application framework
• Backend
• Uses Node.js
• Integrates with MongoDB
• uses the Distributed Data Protocol
• uses a publish–subscribe pattern to propagate data changes to clients without
writing any synchronization code
• Frontend
• depends on jQuery (Blaze = reactive jQuery)
• can be used with any JavaScript UI widget library (e.g., Bootstrap)
7/56
9. Blaze
• Library for creating UIs by writing reactive HTML templates
• Combination of traditional templates and jQuery requires "update logic" in your app that listens for data changes and
manipulates the DOM
• Instead, template directives like {{#if}} and {{#each}} integrate with Tracker's "transparent reactivity" and Minimongo's
database cursors so that the DOM updates automatically
• Blaze has two major parts
• A compiler from template files into JavaScript code that runs against the Blaze runtime library
• Moreover, Blaze provides a compiler toolchain (think LLVM) that can be used to support arbitrary template syntaxes
• The flagship template syntax is Spacebars, a variant of Handlebars
• Community alternative based on Jade is already in use by many apps
• A reactive DOM engine that builds and manages the DOM at runtime
• invoked via templates or directly from the app
• features reactively updating regions, lists, and attributes; event delegation; callbacks and hooks
• Similar to frameworks like React, Angular, Ember, Polymer, Knockout, etc.
• focus on the developer experience, using templating, transparent reactivity, and interoperability with existing libraries
• gentle learning curve
• It hooks into jQuery's clean-up routines to prevent memory leaks, and it preserves classes, attributes, and
styles added to elements by jQuery or any third-party library
9/56
10. Tracker
• Library for transparent reactive programming in JavaScript
• Formerly called Deps
• Functional Reactive Programming (FRP) system without requiring you to
rewrite your program as a FRP data flow graph
• Combined with Tracker-aware libraries, this lets you build complex event-
driven programs without writing a lot of boilerplate event-handling code
• A simple convention, or interface, that lets reactive data sources (database)
talk to reactive data consumers (live-updating HTML templating library)
without the application code in between having to be involved
• Since the convention is very simple, it is quick and easy for library authors
to make their libraries Tracker-aware, so that they can participate in
Tracker reactivity
10/56
11. Alternative web application frameworks
Project Current stable version Release date License
AngularJS 1.4.0 2015-05-26 MIT License
KnockoutJS 3.2.0 2014-08-12 MIT License
Backbone.js 1.1.2 2014-02-20 MIT License
Ember.js 2.0.2 2015-09-07 MIT License
OpenUI5 1.26.8 2015-03-10
Apache 2.0 License by
SAP
Express.js 4.12.3 2015-03-17 MIT License
Unified.js 14.0 2014-04-01
BSD (component only) &
proprietary
11/56
13. Principles of Meteor
• Data on the Wire
• Meteor doesn't send HTML over the network. The server sends data and lets the client render it
• One Language
• both the client and the server parts of your application written in JavaScript
• Database Everywhere
• same methods to access your database from the client or the server
• Latency Compensation
• On the client, Meteor prefetches data and simulates models to make it look like server method calls return
instantly
• Full Stack Reactivity
• All layers, from database to template, update themselves automatically when necessary
• Embrace the Ecosystem
• Meteor is open source and integrates with existing open source tools and frameworks
• Simplicity Equals Productivity
• Meteor's main functionality has clean, classically beautiful APIs
13/56
15. Code rules in Meteor
• Code simultaneously runs in two different environments
• on the client and on the server
• Code behaves differently depending on the environment
• Sometimes we don’t want our code to run in both places
• use booleans Meteor.isClient / Meteor.isServer
• place code in client/ or in server/ folders
• Code in client/ always runs on the client
• Code in server/ always runs on server and is never sent to the client
15/56
16. Variable/function scope in Meteor
• Variables in Meteor declared with the var keyword are scoped to the
file they are declared in
• To define a global variable, don't write the var keyword
• someVarname = 'someValue';
• To define a global function, assign it to a global var
• someFun = function someFun() {...}
• This will define a variable/function in all your application by default
• you may restrict it by writing that declaration in a specific recognized folder
(client or server folder for example)
16/56
20. Collections
Tasks = new Mongo.Collection("dbtasks");
Tasks.insert({ text: "Hello world!",
createdAt: new Date() });
if (Meteor.isClient) {
Template.tasklist.helpers({
tasks: function () {
return Tasks.find({}, {sort:
{createdAt: -1}});
}
});
}
• Built from MongoDB collections
• dbtasks
• Global JS variables
• Both in client and server
• Minimongo on the client
• Auto synchronization
20/56
21. Events for insertion
<template name="tasklist">
<form class="new-task">
<input type="text"
name="text"
placeholder="Type in new
tasks" />
</form>
</template>
Template.tasklist.events({
"submit .new-task": function(event) {
event.preventDefault();
var text = event.target.text.value;
Tasks.insert({
text: text,
createdAt: new Date()
});
event.target.text.value = "";
}
});
21/56
22. Events for update and deletion
<template name="task">
<li class="{{#if checked}}checked{{/if}}">
<button class="delete">×</button>
<input type="checkbox"
checked="{{checked}}"
class="toggle-checked" />
<span class="text">{{text}}</span>
</li>
</template>
Template.task.events({
"click .toggle-checked": function() {
Tasks.update(this._id, {
$set: {checked: ! this.checked}
});
},
"click .delete": function() {
Tasks.remove(this._id);
}
});
this refers to a
task objet (= DC)
_id refers to its
MongoDB id
$set refers to a
MongoDB operator
22/56
25. Session as a reactive data store for the client
• State is usually stored in collections
• the view updates automatically when the data inside these collections are
modified
• Mongo.Collection is recognized by Meteor as a reactive data source
• Meteor knows when the data inside has changed
• Session is the same way, but is not synced with the server like
collections are
• convenient place to store temporary UI state
• No need to write any extra code for the template to update when the Session
variable changes — just calling Session.get(...) inside the helper is enough
25/56
26. EJSON
• EJSON is an extension of JSON to support more types
• It supports all JSON-safe types
• Date (JavaScript Date)
• Binary (JavaScript Uint8Array or the result of EJSON.newBinary)
• User-defined types (see EJSON.addType. For example, Mongo.ObjectID is implemented this way.)
• All EJSON serializations are also valid JSON
• For example an object with a date and a binary buffer would be serialized in EJSON as
{ "d": {"$date": 1358205756553},
"b": {"$binary": "c3VyZS4="} }
• Meteor supports all built-in EJSON data types in
• publishers
• method arguments and results
• Mongo databases
• Session variables
26/56
28. Spacebars
• Four major types of template tags
• {{pageTitle}} - Double-braced template tags are used to insert a string of text.
The text is automatically made safe. It may contain any characters (like <) and
will never produce HTML tags.
• {{> nav}} - Inclusion template tags are used to insert another template by
name.
• {{#each}} - The block tags #if, #each, #with, and #unless are built in, and it is
also possible to define custom ones. Some block tags, like #each and #with,
establish a new data context for evaluating their contents.
• {{{content}}} - Triple-braced template tags are used to insert raw HTML.
28/56
30. Identifiers and Paths
• A Spacebars identifier is either
• a JavaScript identifier name
• any string enclosed in square brackets ( [ and ] )
• The special identifiers this (or equivalently, .) and ..
• Brackets are required to use one of the following as the first element of a path: else, this, true, false, and null
• Brackets are not required around JavaScript keywords and reserved words like var and for
• A Spacebars path is a series of one or more identifiers separated by either . or /
• E.g., foo, foo.bar, this.name, ../title, or foo.[0] (numeric indices must be enclosed in brackets)
• Name Resolution
• The first identifier in a path is resolved in one of two ways
• Indexing the current data context. The identifier foo refers to the foo property of the current data context object.
• As a template helper. The identifier foo refers to a helper function (or constant value) that is accessible from the current template.
• Template helpers take priority over properties of the data context
• If a path starts with .. , then the enclosing data context is used instead of the current one. The enclosing data context might be the one outside
the current #each, #with, or template inclusion.
• Path Evaluation
• When evaluating a path, identifiers after the first are used to index into the object so far, like JavaScript's .(dot) . However, an error is never
thrown when trying to index into a non-object or an undefined value.
• In addition, Spacebars will call functions for you, so {{foo.bar}} may be taken to mean foo().bar, foo.bar(), or foo().bar() as appropriate.
30/56
31. Spacebars caveats
• In Spacebars, the Data Context is the only way to
pass data from template to template
• Data Context can be accessed with the this keyword
• It is inherited by default on templates inclusions, so it
sneaks into everything
• It is silent and the only argument, it is also implicit
• Constructs like #each and #with change the data
context in such a way that access to the parent
data must be done with a weird dotted syntax
• The reason for such syntax is the concept of
"paths" in Spacebars
• A construct like {{person.bio.homeTown}} is not a
property access: it is a path
• The {{../name}} construct makes sense as a path
• Expression {{.}} is equivalent to {{this}}
• Data context is a dynamic variable, that depends
on the chain of calls that led here, rather than the
environment that existed when the template was
defined (lexical variable)
• JavaScript has only one sort-of dynamic variable
called this and people are confused by it
• In JavaScript this is not the main way of passing
arguments to a function
• In Handlebars it is the only way
• Handlebars’ {{#with}} and JavaScript with keyword
• It makes the code confusing, it cripples the scope, it is a
source of bugs, it is deprecated in the strict mode
31/56
33. Data contexts by template tags
• set and used implicitly
• great time-saver
• source of confusion and ambiguity
• set a data context with the {{#with}} and {{/with}} template tags
• {{#with}} takes an argument which becomes the data context of the block enclosed
within the tag
• {{#with}} can be nested to easily access nested objects
• Set a DC with the {{#each}} and {{/each}} helper tags
• {{#each}} takes an argument, usually a cursor resulting of a Collection.find() call
• {{#each}} will then loop over that argument, and set the data context for each
iteration of the loop
33/56
34. Data contexts by template inclusion
• The profile template’s data context can be set to author as it is included from
within that post template
<template name="post">
{{#with post}}
<p>{{content}}</p>
<div>{{> profile author}}</div>
{{/with}}
</template>
• This won’t work if a data context is set inside the profile template (e.g., with a
{{#with}} tag)
34/56
35. Data contexts by Iron Router
• Iron Router can set and manipulate data contexts through its data function
this.route('profile', {
path: '/profile/:_id',
template: 'profile',
data: function() {
return Users.findOne(this.params._id);
}
});
• Defines a route that brings up the profile template while setting its data context to
Users.findOne(this.params._id)
• Setting the data context in the router instead of the template makes it much easier to reuse your template
for different data contexts
35/56
36. Data contexts in JS template helpers
• In a template helper, the data context is
accessible through the this keyword
• A template helper will inherit its data context from
the template itself
• Depending on where you call a template helper, it
might end up with a completely different data
context!
• Because the template’s {{#with}} tag sets the
data context to the name property of the
profile object, the avatarPath and fullName
helpers will end up having different data
contexts, even though they belong to the
same template
<template name="profile">
{{#with profile}}
<img src="{{avatarPath}}"/>
{{#with name}}
<p>{{fullName}}</p>
{{/with}}
{{/with}}
</template>
Template.profile.helpers({
profile: function(){return Users.findOne(Session.get(‘aUserId'));},
avatarPath: function () { // data context set to profile
return "images/" + this.avatar; },
fullName: function () { // data context set to profile.name
return this.first + " " + this.last; }
});
36/56
37. Parent Data Context Access
• Access to the parent’s DC with the .. keyword
• Access to the grandparent’s DC with the ../.. keyword
• Access to any ascendant with
Template.parentData([numLevels])
• access the parent DC by passing `1` as the parameter
<template name="profile">
{{#with profile}}
<img src="{{avatarPath}}"/>
{{#with name}}
{{parentHelper ..}}
<p>{{fullName}}</p>
{{/with}}
{{/with}}
</template>
Template.profile.helpers({
parentHelper: function (parentContext) {
console.log(this); // profile.name data context
console.log(parentContext); // profile data context
}
});
37/56
38. Data Context in Templates
• A “t2” template called within the
“t1” template has access to all
the same data that the “t1”
template has access to
• Data is “trickling down” between
templates which is extremely
useful
38/56
40. Routing with Iron Router
• Routes are used to associate a
URL path with a template
• By default, routes are created for
the client and will run in the
browser
<template name="register">
<h2>Register</h2>
</template>
• Inside the JS file (but outside the
isClient and isServer
conditionals), write
Router.route('/register');
• The following URL is created
http://localhost:3000/register
40/56
41. Linking routes
• Use hard-coded links
<a href="/register">Register</a>
• If the path of the “/register” route
changes, the link will break
• Define a name for each route
Router.route('/', {
name: 'home',
template: 'home'
});
<a href="{{pathFor route='home'}}">
Home</a>
• Use pathFor tag to pass through
the name of a route
• The link will continue to work if the
path of the route ever changes
• The link will only break if the name
of the route is changed
• If name is undefined, the name of
the route will be equal to its path
41/56
42. Route options
• Associate path to template
Router.route('/', {
template: 'home'
});
• Associate name to path
Router.route('/tata', {
name: ‘titi'
});
• Set a DC in route()
data: function() {
var currentUser = Meteor.userId();
return Dossiers.find({id_user:
currentUser});
},
• Load subscriptions
waitOn: function(){
return Meteor.subscribe('dossiers');
}
42/56
43. Hook for checking before routing
• Use the onBeforeAction hook
Router.route('/list/:_id', {
name: 'listPage',
template: 'listPage',
onBeforeAction: function(){
var currentUser = Meteor.userId();
if ( currentUser ) {
this.next();
} else {
this.render('login');
}
}
});
43/56
49. Import from npm/atmosphere packages
• default import from npm
import moment from 'moment';
• named import from Atmosphere
import { HTTP } from 'meteor/http';
• Importing Meteor “pseudo-globals”
import { Name } from 'meteor/package‘;
import { Meteor } from 'meteor/meteor';
import { EJSON } from 'meteor/ejson'
49/56
50. Installing & using npm packages
• install a package into your app
meteor npm install --save package_name
• use a npm package from a file in your app, you simply import the name of the
package, this imports the default export from the package into the symbol
package
import package from 'package_name';
• you can also import specific functions from a package using the destructuring
syntax
import { isArray } from 'lodash';
• you can also import other files or JS entry points from a package
import { parse } from 'graphql/language';
50/56
51. Installing & using Atmosphere packages
• install an Atmosphere package
meteor add kadira:flow-router
• use an Atmosphere package, you can import it with the meteor/
prefix
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
51/56
53. Command line toolmeteor create <name>
Make a subdirectory called <name> and create a new Meteor app there.
meteor run
Serve the current app at http://localhost:3000 using Meteor's local development server.
meteor debug
Run the project with Node Inspector attached, so that you can step through your server code line by line.
See meteor debug in the full docs for more information.
meteor deploy <site>
Bundle your app and deploy it to <site>.
Meteor provides free hosting if you deploy to <your app>.meteor.com as long as <your app> is a name that has not been claimed by someone else.
meteor update
Update your Meteor installation to the latest released version and then (if meteor update was run from an app directory)
update the packages used by the current app to the latest versions that are compatible with all other packages used by the app.
meteor add
Add a package (or multiple packages) to your Meteor project. To query for available packages, use the meteor search command.
meteor remove
Remove a package previously added to your Meteor project.
For a list of the packages that your application is currently using, use the meteor list command.
meteor mongo
Opens a MongoDB shell for viewing and/or manipulating collections stored in the database.
Note that you must already be running a server for the current app (in another terminal window) in order for meteor mongo to connect to the
app's database.
meteor reset
Reset the current project to a fresh state. Removes all local data. 53/56
54. Names and IDs
• HTML
• name
• must be unique within one <form>
only
• used by <form> controls such as
<input> and <select>
• used by GET and POST calls
• value
• content of name
• type
• CSS and JS
• id
• unique
• used by # in URLs and events
• used by the DOM
• class
• not unique
• used by . in events
• element can have many classes
• used by the DOM
54/56
55. Javascript objects
• unordered collection of properties
• each property is a (name, value) pair
• a name must be a unique string (inside the object)
• property attributes
• writable : can be set
• enumerable : property name is returned by a for/in loop
• configurable : can be deleted
• object attributes
• prototype : is a reference to another object from which
properties are inherited
• class : is a string that categorizes the type of an object
• the extensible flag specifies (in ECMAScript 5) whether
new properties may be added to the object
• var y = x // by reference, not by copy!
• A native object is an object or class of objects
defined by the ECMAScript specification
• Arrays, functions, dates, and regular expressions (for
example) are native objects
• A host object is an object defined by the host
environment (such as a web browser) within which
the JavaScript interpreter is embedded
• The HTMLElement objects that represent the structure
of a web page in client-side JavaScript are host objects
• Host objects may also be native objects, as when the
host environment defines methods that are normal
JavaScript Function objects
• A user-defined object is any object created by the
execution of JavaScript code.
• An own property is a property defined directly on
an object
• An inherited property is a property defined by an
object’s prototype object
55/56
56. Arrow functions
• An arrow function expression has a shorter syntax compared to function expressions and lexically binds the
this value (does not bind its own this, arguments, super, or new.target)
• Arrow functions are always anonymous
(param1, param2, …, paramN) => { statements }
(param1, param2, …, paramN) => expression
• equivalent to: => { return expression; }
• Parentheses are optional when there's only one parameter
(singleParam) => { statements }
singleParam => { statements }
• A function with no parameters requires parentheses
() => { statements }
56/56