The document provides an introduction to Typesafe Activator and the Play Framework. It discusses how Activator is a tool that helps developers get started with the Typesafe Reactive Platform and Play applications. It also covers some core features of Play like routing, templates, assets, data access with Slick and JSON, and concurrency with Futures, Actors, and WebSockets.
Node.js Development with Apache NetBeansRyan Cuprak
This session covers the basics of developing Node.js applications with NetBeans. NetBeans includes fully integrated support for both JavaScript and Node.js. You’ll get a tour of the features and learn how NetBeans can accelerate your projects. The presentation looks at basic code editing capabilities provided by the IDE, tool integration (npm/Grunt/Bower/Webpack), frameworks such as Express, and debugging capabilities. You’ll see why NetBeans is the best free JavaScript/Node.js IDE.
Java 9 ships in July, are you ready for Java 9 modules? Java 9 modules (aka Project Jigsaw) is the biggest fundamental change to the Java runtime. Code that use Oracle/Sun private APIs will break. This session will cover the basics of Java 9 modules and also the current state of tooling. The ramifications to existing and legacy applications will be covered along with the steps you’ll need to take to harness the power of modules and write more maintainable systems.
The document discusses the Play framework, an agile web development framework created by Guillaume Bort in 2007. It provides an overview of Play's main concepts including its stateless MVC architecture, ability to fix bugs and reload code without restarting, efficient templating, and support for test-driven development. The document also covers getting started with Play and using modules to add additional functionality.
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
What is different about this generation of web applications? A solid development approach must consider latency, throughput, and interactivity demanded by users users across mobile devices, web browsers, and IoT. These applications often use NoSQL to support a flexible data model and easy scalability required for modern development.
A full stack application (composed of Couchbase, WebAPI, Angular2, and ASP.NET/ASP.NET Core) will be demonstrated in this session. The individual parts of a stack may vary, but the overall design is the focus.
This document provides an overview of Xitrum, an asynchronous and clustered Scala web framework built on top of Netty and Akka. It describes what Xitrum is, why it should be used, how it works, examples of its features like actions, views, routing, authentication, and more. It also provides links to the Xitrum homepage, guides, community, and examples of where Xitrum is used in production.
FITC - Here Be Dragons: Advanced JavaScript DebuggingRami Sayar
This document discusses common types and locations of errors in JavaScript, tools for debugging and introspecting JavaScript code, and methods for remotely debugging Node.js and front-end JavaScript applications. It covers loading errors, runtime errors, logic errors, and frequent error locations in JavaScript. Debugging tools discussed include node-inspector, Visual Studio Code, Vantage, and Vorlon.js. Remote debugging of Node.js processes and front-end code is also covered.
Video of the presentation: http://www.youtube.com/watch?v=8z3h4Uv9YbE
At LinkedIn, we have started to use the Play Framework to build front-end and back-end services at massive scale. Play does things a little differently: it's a Java and Scala web framework, but it doesn't follow the servlet spec; it's fairly new, but it runs on top of robust technologies like Akka and Netty; it uses a thread pool, but it's built for non-blocking I/O and reactive programming; most importantly, it's high performance, but also high productivity. We've found that the Play Framework is one of the few frameworks that is able to maintain the delicate balance of performance, reliability, and developer productivity. In the Java and Scala world, nothing even comes close. In this talk, I'll share what we've learned so far, including details of rapid iteration with Java and Scala, the story behind async I/O on the JVM, support for real time web apps (comet, WebSockets), and integrating Play into a large existing codebase.
Xitrum is a Scala web framework inspired by Rails that provides asynchronous and clustered capabilities. It uses Netty for asynchronous IO, Hazelcast for clustered data, and Akka for remote code. The framework was created because existing Scala options like Scalatra and Lift were not fully featured or easy to use from a Ruby perspective. Xitrum aims to provide more features than Scalatra and easier use than Lift. It has been used in many of the creator's projects involving chat systems, APIs, and real-time websites.
From previously developed a simple web application (based on X-Files tv series) the aim will be to set both user authentication and authorization of web resources both for themselves and for the invocation of business components. It’ll be established a minimum security settings, which will be completed with more sophisticated mechanisms. All of these emphasizing the novelties of version 3.x of Spring Security as the use of SPEL, Annotations, Namespace, Java config, etc. Attendees will see many of the features that implements Spring Security to set security mechanisms within JEE applications. The tools to be used are Spring Tool Suite 3.4, Springframework 3.2, Maven 3 and Spring Tc Server 2.9.
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra Sencha
In this session, Lee will cover the top 10 new features of ECMAScript 2015, their benefits, and go through code examples of how to use them. She will also talk about ECMAScript 2015 compatibilities and incompatibilities with the most widely used browsers today, and how you should plan on developing your applications with ECMAScript 2015.
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...Sencha
Using modern browsers, developers can now create web apps with capabilities that were only possible in native or hybrid apps. Web apps can now access hardware devices such as microphones, cameras, GPS, accelerometers, VR displays, and many others, without using any plugins. Using Web Bluetooth, web app developers can now communicate with nearly any type of hardware device. In this session, we’ll survey a sample of the W3C standards that give developers access to next-gen capabilities via web apps. Topics will include Service Worker, Push API, WebRTC, Web Bluetooth, Web Crypto, Web Speech, Web Notifications, and others.
Welcome to presentation on Spring boot which is really great and relatively a new project from Spring.io. Its aim is to simplify creating new spring framework based projects and unify their configurations by applying some conventions. This convention over configuration is already successfully applied in so called modern web based frameworks like Grails, Django, Play framework, Rails etc.
Exploring Java Heap Dumps (Oracle Code One 2018)Ryan Cuprak
Memory leaks are not always simple or easy to find. Heap dumps from production systems are often gigantic (4+ gigs) with millions of objects in memory. Simple spot checking with traditional tools is woefully inadequate in these situations, especially with real data. Leaks can be entire object graphs with enormous amounts of noise. This session will show you how to build custom tools using the Apache NetBeans Profiler/Heapwalker APIs. Using these APIs, you can read and analyze Java heaps programmatically to ask really hard questions. This gives you the power to analyze complex object graphs with tens of thousands of objects in seconds.
Maven is a Java project management and build tool that uses a Project Object Model (POM) defined in XML files to manage a project's build, reporting and documentation from a central information source. It is based on a small core with numerous plugins that can be used to compile code, run tests, generate documentation and more. Maven uses local and remote repositories to download dependencies and build artifacts that projects specify in their POM files.
Securing Microservices using Play and Akka HTTPRafal Gancarz
Going down the microservices route makes a lot of things around creating and maintaining large systems easier but it comes at a cost too, particularly associated with challenges around security. While securing monolithic applications was a relatively well understood area, the same can't be said about microservice based architectures.
This presentation covers how implementing microservices affects the security of distributed systems, outlines pros and cons of several standards and common practices and offers practical suggestions for securing microservice based systems using Play and Akka HTTP.
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
The document discusses migrating the DeviceHive Java server from a Java EE implementation to a Spring Boot implementation. It describes DeviceHive as an open-source M2M framework that allows two-way communication with remote devices using cloud middleware. It then outlines some of the key components in the existing Java EE implementation and how they would map to Spring and Spring Boot, including using Spring MVC instead of JAX-RS, Spring services instead of EJBs, and deploying to Tomcat instead of a full Java EE server. It also discusses features of Spring Boot like easy deployment of standalone applications and auto-configuration of common dependencies.
This document provides an overview of the CQ5 content management system, including its overall architecture, core components like JCR, Sling, Felix, and OSGi bundles. It describes the Java Content Repository specification and Jackrabbit implementation. It also covers key CQ5 functional aspects such as authoring, workflows, assets and more. Finally, it references additional documentation and community resources for CQ5.
50 features of Java EE 7 in 50 minutes at Geecon 2014Arun Gupta
This document provides a summary of 50 features of Java EE 7 across various Java EE technologies like CDI, EJB, JPA, JTA, JMS and more. Each feature is summarized in 1-2 lines with the specification and a brief description. The document is aimed at covering 50 features of Java EE 7 in 50 minutes for developers to get up to speed with the latest additions and enhancements in various Java EE technologies.
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...Speedment, Inc.
The best code is the one you never need to write. Using code generation and automated builds, you can minimize the risk of human error when developing software, but how do you maintain control over code when large parts of it are handed over to a machine? In this tutorial, you will learn how to use open source software to create and control code automation. You will see how you can generate a completely object-oriented domain model by automatically analyzing your database schemas. Every aspect of the process is transparent and configurable, giving you, as a developer, 100 percent control of the generated code. This will not only increase your productivity but also help you build safer, more maintainable Java applications and is a perfect solution for Microservices.
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...Malin Weiss
The best code is the one you never need to write. Using code generation and automated builds, you can minimize the risk of human error when developing software, but how do you maintain control over code when large parts of it are handed over to a machine? In this tutorial, you will learn how to use open source software to create and control code automation. You will see how you can generate a completely object-oriented domain model by automatically analyzing your database schemas. Every aspect of the process is transparent and configurable, giving you, as a developer, 100 percent control of the generated code. This will not only increase your productivity but also help you build safer, more maintainable Java applications and is a perfect solution for Microservices.
Silicon Valley JUG - How to generate customized java 8 code from your databaseSpeedment, Inc.
The best code is the one you never need to write. Using code generation and automated builds you can minimize the risk of human error when developing software, but how do you maintain control over code when large parts of it is handed over to a machine? In this tutorial, you will learn how to use open-source software to create and control code automation. You will see how you can generate a completely object-oriented domain model by automatically analyzing your database schemas. Every aspect of the process is transparent and configurable, giving you as a developer 100% control of the generated code. This will not only increase your productivity, but also help you build safer and more maintainable Java applications.
How to generate customized java 8 code from your databaseSpeedment, Inc.
Did you know that database classes, that require many lines of Java and SQL code, may be replaced with a single line of Java 8 code? In this tutorial session you will learn how to use standard Java 8 Streams as an alternative to traditional Object Relational Mappers (ORM). We will use the open-source tool Speedment to show how development speed can be increased and how the application code can be more concise and run faster.
This document discusses various technologies related to architectures, frameworks, infrastructure, services, data stores, analytics, logging and metrics. It covers Java 8 features like lambda expressions and method references. It also discusses microservices, Spring Boot basics and features, Gradle vs Maven, Swagger, AngularJS, Gulp, Jasmine, Karma, Nginx, CloudFront, Couchbase, Lambda Architecture, logging with Fluentd and Elasticsearch, metrics collection with Collectd and Statsd, and visualization with Graphite and Grafana.
AngularJS 1.x - your first application (problems and solutions)Igor Talevski
We will talk about all aspects of building a single page application with AngularJS, and we will discuss real examples from day-to-day work. We will also cover a large amount of theory about general web development, best practices, and today's client demands. We will focus on three (3) main points: architecture, security, and real time notification.
Whether you are building a mobile app or a web app, Apache Usergrid (incubating) can provide you with a complete backend that supports authentication, persistence and social features like activities and followers all via a comprehensive REST API — and backed by Cassandra, giving you linear scalability. This session will tell you what you need to know to be a Usergrid contributor, starting with the basics of building and running Usergrid from source code. You’ll learn how to find your way around the Usergrid code base, how the code for the Stack, Portal and SDKs and how to use the test infrastructure to test your changes to Usergrid. You’ll learn the Usergrid contributor workflow, how the project uses JIRA and Github to manage change and how to contribute your changes to the project. The session will also cover the Usergrid roadmap and what the community is currently working on.
DISQUS is a comment system that handles high volumes of traffic, with up to 17,000 requests per second and 250 million monthly visitors. They face challenges in unpredictable spikes in traffic and ensuring high availability. Their architecture includes over 100 servers split between web servers, databases, caching, and load balancing. They employ techniques like vertical and horizontal data partitioning, atomic updates, delayed signals, consistent caching, and feature flags to scale their large Django application.
Scala is widely used at Treasure Data for data analytics workflows, management of the Presto query engine, and open-source libraries. Some key uses of Scala include analyzing query logs to optimize Presto performance, developing Prestobase using Scala macros and libraries like Airframe, and integrating Spark with Treasure Data. Treasure Data engineers have also created several open-source Scala libraries, such as wvlet-log for logging and Airframe for dependency injection, and sbt plugins to facilitate packaging, testing, and deployment.
Running Airflow Workflows as ETL Processes on Hadoopclairvoyantllc
While working with Hadoop, you'll eventually encounter the need to schedule and run workflows to perform various operations like ingesting data or performing ETL. There are a number of tools available to assist you with this type of requirement and one such tool that we at Clairvoyant have been looking to use is Apache Airflow. Apache Airflow is an Apache Incubator project that allows you to programmatically create workflows through a python script. This provides a flexible and effective way to design your workflows with little code and setup. In this talk, we will discuss Apache Airflow and how we at Clairvoyant have utilized it for ETL pipelines on Hadoop.
This document provides an overview of single page applications (SPAs) and AngularJS. It discusses why SPAs are useful, how they work, and key aspects of AngularJS like data binding, directives, routing, and dependency injection. Code samples are presented to demonstrate basic concepts like data binding, controllers, filters, and building an e-commerce application with routing and services. Future sessions are proposed to cover integration with Node.js backends, testing with Karma, and custom directives.
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...J V
Alfresco Summit 2014 (London)
Though best practice is to leverage Alfresco through the well defined API's, it can be useful to understand the internals of the repository so that your development efforts are the most effective. A deep understanding of the repository will help you to evaluate performance bottlenecks, look for bugs, or make contributions. This session provides an overview of the repository internals, including the major components, the key services, subsystems, and database. We then provide an example where we leverage the repository in a micro-service architecture while building Alfresco's future cloud products and show how the different parts of the repository interact to fulfill requests.
http://summit.alfresco.com/london/sessions/diving-deep-alfresco-repository
https://www.youtube.com/watch?v=TAE9UjC0xxc
This document discusses technologies for creating and maintaining web applications. It covers Ruby and the Rails framework. Ruby is designed to be programmer-focused rather than machine-focused, helping create dynamic and self-explained code. Rails enables quickly building web servers through conventions, reuse, single responsibility principles, and features that provide quick setup, deployment, and built-in scalability. The document also discusses front-end architecture with client-side logic, and Rails features for development, deployment, databases, assets, and multi-environment configuration.
Code for Startup MVP (Ruby on Rails) Session 1Henry S
First Session on Learning to Code for Startup MVP's using Ruby on Rails.
This session covers the web architecture, Git/GitHub and makes a real rails app that is deployed to Heroku at the end.
Thanks,
Henry
Chef for OpenStack - OpenStack Fall 2012 SummitMatt Ray
Chef for OpenStack is a collaborative project for the deployment and management of OpenStack clouds. This is an overview of the status of the project at the OpenStack Fall 2012 Summit
This document discusses Chef for OpenStack, which uses Chef to automate the deployment and management of OpenStack. It provides concise summaries of key points:
- Chef for OpenStack includes cookbooks for common OpenStack components like Keystone, Glance, Nova, and Swift that can be used to programmatically deploy and manage OpenStack infrastructure.
- The Chef community contributes to OpenStack-related cookbooks that are open source and available on GitHub, helping reduce fragmentation and encourage collaboration around automating OpenStack.
- Chef allows OpenStack infrastructures to be treated like code, with configurations version controlled and deployments that can be automatically reconstructed from backups, improving supportability and portability across environments.
Chef is an open source configuration management and service integration automation tool that has been integral to a number of large successful OpenStack deployments. This talk will provide a brief introduction to Chef and why it frequently the configuration tool of choice for large deployments and discuss the use of Chef within the OpenStack ecosystem (development, testing, deploying and managing the installation). Chef also provides the ability to manage the instances running on top of Nova through the knife-openstack plugin.
Introduction in the JavaScript Programming language typically used in the front end of Web Applications. More information can be found at : https://www.spiraltrain.nl/course-javascript-programming/?lang=en
SharePoint developers regularly face the decision, where do I put my application’s data? Sometimes this is an easy choice, using SharePoint Lists, or a SQL Server Database, but often a better solution exists. Or at least knowing that alternatives exist is beneficial, and further knowing when to use them. There are actually many storage options that both ASP.NET and SharePoint (along with modern browsers, HTML5, JavaScript) offer. This session will discuss many of these choices with best practices in mind along with live demonstrations. Examples include SharePoint Lists, Secure Store, property bags, persisted objects, Linq (to SQL, Entity, and SharePoint), web part properties, serialization options (to/from JSON and XML), session state, viewstate, httpruntime, application state, and thread bag. Also, client side storage examples will be introduced using modern HTML5 and JavaScript techniques. Further, free 3rd party products will be introduced that can be employed. Applies to all modern versions of SharePoint including 2013.
Achieving Infrastructure Portability with ChefMatt Ray
Deploying to the cloud has made it easy to run large numbers of servers, but users may become dissatisfied with their particular cloud platform for reasons such as price, support and performance. There are a number of vendor lock-ins to avoid, this talk discusses how to do so with the open source configuration management and infrastructure automation platform Chef. Chef makes it easy to deploy to nearly every public and private cloud platform as well as virtualized and physical servers. Chef may also be used to deploy cloud infrastructures such as OpenStack, Eucalyptus or CloudStack. By abstracting away the platform, infrastructure becomes portable and you are free to deploy wherever necessary.
Cultural Shifts: Embracing DevOps for Organizational TransformationMindfire Solution
Mindfire Solutions specializes in DevOps services, facilitating digital transformation through streamlined software development and operational efficiency. Their expertise enhances collaboration, accelerates delivery cycles, and ensures scalability using cloud-native technologies. Mindfire Solutions empowers businesses to innovate rapidly and maintain competitive advantage in dynamic market landscapes.
Are you wondering how to migrate to the Cloud? At the ITB session, we addressed the challenge of managing multiple ColdFusion licenses and AWS EC2 instances. Discover how you can consolidate with just one EC2 instance capable of running over 50 apps using CommandBox ColdFusion. This solution supports both ColdFusion flavors and includes cb-websites, a GoLang binary for managing CommandBox websites.
Ansys Mechanical enables you to solve complex structural engineering problems and make better, faster design decisions. With the finite element analysis (FEA) solvers available in the suite, you can customize and automate solutions for your structural mechanics problems and parameterize them to analyze multiple design scenarios. Ansys Mechanical is a dynamic tool that has a complete range of analysis tools.
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...Hironori Washizaki
Hironori Washizaki, "Charting a Course for Equity: Strategies for Overcoming Challenges and Promoting Inclusion in the Metaverse", IEEE COMPSAC 2024 D&I Panel, 2024.
Break data silos with real-time connectivity using Confluent Cloud Connectorsconfluent
Connectors integrate Apache Kafka® with external data systems, enabling you to move away from a brittle spaghetti architecture to one that is more streamlined, secure, and future-proof. However, if your team still spends multiple dev cycles building and managing connectors using just open source Kafka Connect, it’s time to consider a faster and cost-effective alternative.
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple StepsEstuary Flow
Unlock the full potential of your data by effortlessly migrating from PostgreSQL to Snowflake, the leading cloud data warehouse. This comprehensive guide presents an easy-to-follow 8-step process using Estuary Flow, an open-source data operations platform designed to simplify data pipelines.
Discover how to seamlessly transfer your PostgreSQL data to Snowflake, leveraging Estuary Flow's intuitive interface and powerful real-time replication capabilities. Harness the power of both platforms to create a robust data ecosystem that drives business intelligence, analytics, and data-driven decision-making.
Key Takeaways:
1. Effortless Migration: Learn how to migrate your PostgreSQL data to Snowflake in 8 simple steps, even with limited technical expertise.
2. Real-Time Insights: Achieve near-instantaneous data syncing for up-to-the-minute analytics and reporting.
3. Cost-Effective Solution: Lower your total cost of ownership (TCO) with Estuary Flow's efficient and scalable architecture.
4. Seamless Integration: Combine the strengths of PostgreSQL's transactional power with Snowflake's cloud-native scalability and data warehousing features.
Don't miss out on this opportunity to unlock the full potential of your data. Read & Download this comprehensive guide now and embark on a seamless data journey from PostgreSQL to Snowflake with Estuary Flow!
Try it Free: https://dashboard.estuary.dev/register
Efficient hot work permit software for safe, streamlined work permit management and compliance. Enhance safety today. Contact us on +353 214536034.
https://sheqnetwork.com/work-permit/
A captivating AI chatbot PowerPoint presentation is made with a striking backdrop in order to attract a wider audience. Select this template featuring several AI chatbot visuals to boost audience engagement and spontaneity. With the aid of this multi-colored template, you may make a compelling presentation and get extra bonuses. To easily elucidate your ideas, choose a typeface with vibrant colors. You can include your data regarding utilizing the chatbot methodology to the remaining half of the template.
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.bhatinidhi2001
CViewSurvey is a SaaS-based Web & Mobile application that provides digital transformation to traditional paper surveys and feedback for customer & employee experience, field & market research that helps you evaluate your customer's as well as employee's loyalty.
With our unique C.A.A.G. Collect, Analysis, Act & Grow approach; business & industry’s can create customized surveys on web, publish on app to collect unlimited response & review AI backed real-time data analytics on mobile & tablets anytime, anywhere. Data collected when offline is securely stored in the device, which syncs to the cloud server when connected to any network.
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...onemonitarsoftware
Unlock the full potential of mobile monitoring with ONEMONITAR. Our advanced and discreet app offers a comprehensive suite of features, including hidden call recording, real-time GPS tracking, message monitoring, and much more.
Perfect for parents, employers, and anyone needing a reliable solution, ONEMONITAR ensures you stay informed and in control. Explore the key features of ONEMONITAR and see why it’s the trusted choice for Android device monitoring.
Share this infographic to spread the word about the ultimate mobile spy app!
Discover the Power of ONEMONITAR: The Ultimate Mobile Spy App for Android Dev...
Play Framework and Activator
1. Play Framework and Activator
Getting started with the Play Framework with Activator
2. Topics, goals, context
2
• An introduction to Typesafe Activator
• An introduction to the core features of Play 2.x
• What is a Reactive application, and how do you build one with Play?
7. Activator Overview
7
• Learn — In depth tutorials
• Develop — Code, compile, test,
run, inspect
• Deliver — Monitoring
integration with AppDynamics
and New Relic
8. Code view
8
• Activator
• Browse code
• Make small changes
• IDE
• Generate IDEA or Eclipse
project files
• Dig into the template in your
favourite IDE
9. Development monitoring
9
• Incoming requests
• Controller
• HTTP verb (GET, POST, etc)
• Response code
• Invocation time
10. Inspect — Development monitoring
10
• Actor metrics
• Throughput — messages/s
• Max time — high watermark
• Max size — mailbox
11. Monitoring and support
11
• Application monitoring
• Need production caliber monitoring?
• AppDynamics or New Relic integration
• Support
• Ready to take your application to the
next level?
• http://typesafe.com/how/subscription
12. Contributing a template — tutorials vs seeds
12
• Seed
• Boilerplate code as a starting point
• Tutorial
• Teaching about a particular focused topic or integration
• Components
• Activator templates are just regular sbt projects with some additional components
• Metadata (activator.properties), license, sbt build file, tutorial (tutorial/index.html)
• Contribute!
• https://typesafe.com/activator/template/contribute
13. The Typesafe Activator UI is a Play framework application.
!
Peek behind the covers…
!
https://github.com/typesafehub/activator/tree/master/ui
14. Play 2.3 overview
14
• Stateless MVC framework with routing, a template engine, REST support, etc
• Dynamic class reloading
• Support for Java 8 and Scala 2.1x
• sbt-web to implement an asset pipeline
• Akka interoperability for highly concurrent web applications
• Built on Netty 3.9.x
17. 17
Simplified HTTP request
1. mydomain.com/admin/settings
renders views.html.admin HTML
2. Browser fetches static assets served
from outside of Play
3. Ajax requests — Play serves JSON
via a RESTful API
Browser Play
HTTP GET (mydomain.com/admin/settings)
HTML for views.html.admin(...)
CDN
JS, CSS, images, etc
HTTP GET (mydomain.com/ws/some/services)
JSON
18. Example template with AngularJS
18
@(customer: Customer)!
!
<head>...</head>!
<body>!
<div class="wrapper">!
<header>…</header>!
<h1>Welcome @customer.name!</h1>!
<section id="body" ng-app="ngAdmin">!
<div ng-view></div>!
</section>!
<footer>...</footer>!
</div>!
</body>!
</html>
load async || fail whale
• Scala template rendered by Twirl and returned by Play controller
Header
Play handles navigation
Footer
• HTML inserted into ng-view by Angular controller after initial page render
load async || omit
AngularJS
20. routes
20
GET !/admin!! ! ! ! controllers.AdminController.index!
GET ! /admin/login! ! ! controllers.AdminController.login!
GET ! /admin/*any! ! ! controllers.AdminController.angularWildcard(any: String)!
GET ! /ws/some/service! ! controllers.ServiceController.service
• Routes must be declared in order
• /admin and /admin/login are used to render Scala view templates
• /admin/*any will be intercepted by client-side routing in AngularJS
• Client-side routes may hit the server if the URI has been bookmarked
• Nothing special about web services aside from payload (JSON vs HTML)
21. Sample controller action
21
/**!
* Renders the admin template.!
*/!
def index = Action.async {!
implicit request =>!
val account = loggedIn!
Ok(views.html.admin()).withCookies(Cookie(“…”, …, httpOnly = false))!
}
• Controllers should stay thin and delegate the real work
• Controllers actions should always be async
• Controllers are stateless so context must be stored in cookies or cached
22. Asynchronous vs synchronous processing times
22
Asynchronous - 200ms
Process 1
Process 2
75 ms
Process 3
200 ms
150 ms
0 ms 425 ms
Synchronous - 425ms
Process 1 Process 2 Process 3
0 ms 425 ms
• Staying async — and in the future —
ensures that processing time is not
bounded by IO
• Async processing is limited by only
the longest running process
• Synchronous processing is limited by
the combined processing times
• Stay async!
24. An intro to sbt-web
24
• sbt-web brings the notion of a highly configurable asset pipeline to build files
pipelineStages := Seq(rjs, digest, gzip)!
• The above will order the RequireJs optimizer (sbt-rjs), the digester (sbt-digest) and
then compression (sbt-gzip)
• These tasks will execute in the order declared, one after the other
26. Asset pipelines
26
• Linting
• Inspect source code for suspicious language usage
• Uglification/minification
• Mangle and compress source files, e.g, remove whitespace, etc
• Fingerprinting
• Change the filename to reflect the contents of the file for cache busting
• Concatenation
• Combine multiple source files to reduce browser load times
27. sbt-web and asset fingerprinting
27
• Asset fingerprinting makes the name of a file dependent on the contents of the file
• HTTP headers can be set to encourage caches to keep their own copy of the content
• When the content is updated, the fingerprint will change
• This will cause the remote clients to request a new copy of the content
• Known as cache busting
28. Turning on asset fingerprinting
28
• Turning on asset fingerprinting only requires one additional route
GET /assets/*file! controllers.Assets.versioned(path="/public", file: Asset)
• Then request each asset as versioned
<link rel="stylesheet" href=“@routes.Assets.versioned('assets/images/example.png')">
• A digest file and new file will be created based on MD5
./target/web/digest/images/23dcc403b263f262692ac58437104acf-example.png!
./target/web/digest/images/example.png.md5
31. Model-tier considerations
31
Think in verbs rather than nouns…
• save(model)
• SRP — save is likely a simple function that does a single thing
• model.save()
• Violates SRP — tougher to test
• Play makes it easy to implement your preferred solution to persistence
• CRUD, CQRS (Command Query Responsibility Segregation), etc
32. Scala — Slick example
32
// This code:!
coffees.filter(_.price < 10.0).map(_.name)!
!
// Will produce a query equivalent to the following SQL:!
select COF_NAME from COFFEES where PRICE < 10.0
• Slick is a Functional Relational Mapping (FRM) library for Scala where you work with
relational data in a type-safe and functional way
• Developers benefit from the type-safety and composability of FRM as well as being
able to reuse the typical Scala collection APIs like filter, map, foreach, etc
• Can also use plain SQL for insertions, complex joins, etc
• http://typesafe.com/activator/template/hello-slick-2.1
33. Scala — JSON Writes example
33
• Simply define a Writes in
implicit scope before invoking
toJson
implicit val locationWrites = new Writes[Location] {!
def writes(location: Location) = Json.obj(!
"lat" -> location.lat,!
"long" -> location.long!
)!
}!
!
val json = Json.toJson(location)
34. Scala — JSON Reads example
• Also elegantly handles Reads
• Build in validate using standard
types (e.g, Double, Int, etc) or
define your own validators
34
implicit val locationReads: Reads[Location] = (!
(JsPath "lat").read[Double] and!
(JsPath "long").read[Double]!
)(Location.apply _)!
!
val json = { ... }!
!
val locationResult: JsResult[Location] = !
! json.validate[Location]
36. “If you want to parallelize a very deterministic algorithm, futures are the
way to go.”
- Derek Wyatt, Akka Concurrency
37. Futures
37
def index = Action.async {!
! val futureInt = scala.concurrent.Future { intensiveComputation() }!
! futureInt.map(i => Ok("Got result: " + i))!
}
• Great for handling immutable state
• Intensive computations, reading from a database, pulling from web services, etc
• Composition — futures guarantee order when chained
• Parallelizing a deterministic algorithm
38. “Add behaviour to an algorithm by inserting actors into the message
flow.”
- Derek Wyatt, Akka Concurrency
39. Actors
• Great for handling mutable state
• Easy for imperative developers to dive
into quickly
• Don't guarantee order
• Easy to change behaviour by inserting
new actors into the message flow
• Messages are directed to a specific actor,
avoiding callback hell
39
package actors!
!
import akka.actor._!
!
object SomeActor {!
! def props = Props(new GameActor)!
}!
!
class SomeActor extends Actor {!
! def receive = {!
! ! case request: SomeRequest => {!
! ! ! sender ! SomeResponse(...) !
! ! }!
! }!
}!
40. WebSockets
def websocketAction = WebSocket.acceptWithActor[JsValue, JsValue] { request => channel =>!
! SomeActor.props(channel)!
}!
40
• Play provides two different built in mechanisms for handling WebSockets
• Actors — better for discreet messages
• Iteratees — better for streams
• Both of these mechanisms can be accessed using the builders provided on WebSocket
42. Test framework comparison
42
• ScalaTest
• Human readable output — in English
• FeatureSpec
• Matchers
• http://www.artima.com/docs-scalatest-2.0.M8/#org.scalatest.Matchers
• Great writeup by Gilt
• http://tech.gilt.com/post/62430610230/which-scala-testing-tools-should-you-use
43. Test framework comparison
43
• Specs2
• Enabled by default in Play
• Good choice for international teams who gain less from English readability
• Both Specs2 and ScalaTest are fantastic!
45. Play 2.4
45
• Built-in dependency injection support
• Experimental support for running Play on akka-http
• Experimental support for handling IO in Java and Scala using Reactive Streams
• Slick over anorm, JPA over ebean
• Pull anorm/ebean support out into separate modules in GitHub playframework repo