Introduction and Overview of Apache Kafka, TriHUG July 23, 2013mumrah
Apache Kafka is a distributed publish-subscribe messaging system that allows both publishing and subscribing to streams of records. It uses a distributed commit log that provides low latency and high throughput for handling real-time data feeds. Key features include persistence, replication, partitioning, and clustering.
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...Julian Hyde
Apache Calcite is an open source framework for building data management systems that allows for optimized query processing over heterogeneous data sources. It uses a flexible relational algebra and extensible adapter-based architecture that allows it to incorporate diverse data sources. Calcite's rule-based optimizer transforms logical query plans into efficient physical execution plans tailored for different data sources. It has been adopted by many projects and companies and is also used in research.
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Julian Hyde
A talk from given by Julian Hyde and Tomer Shiran at Hadoop Summit, Dublin.
Data scientists and analysts want the best API, DSL or query language possible, not to be limited by what the processing engine can support. Polyalgebra is an extension to relational algebra that separates the user language from the engine, so you can choose the best language and engine for the job. It also allows the system to optimize queries and cache results. We demonstrate how Ibis uses Polyalgebra to execute the same Python-based machine learning queries on Impala, Drill and Spark. And we show how to build Polyalgebra expressions in Calcite and how to define optimization rules and storage handlers.
Raft protocol has been successfully used for consistent metadata replication; however, using it for data replication poses unique challenges. Apache Ratis is a RAFT implementation targeted at high throughput data replication problems. Apache Ratis is being successfully used as a consensus protocol for data stored in Ozone (object store) and Quadra(block device) to provide data throughput that saturates the network links and disk bandwidths.
Pluggable nature of Ratis renders it useful for multiple use cases including high availability, data or metadata replication, and ensuring consistency semantics.
This talk presents the design challenges to achieve high throughput and how Apache Ratis addresses them. We talk about specific optimizations that have been implemented to minimize overheads and scale up the throughput while maintaining correctness of the consistency protocol. The talk also explains how systems like Ozone take advantage of Ratis’s implementation choices to achieve scale. We will discuss the current performance numbers and also future optimizations. MUKUL KUMAR SINGH, Staff Software Engineer, Hortonworks and LOKESH JAIN, Software Engineer, Hortonworks
Step-by-Step Introduction to Apache Flink Slim Baltagi
This a talk that I gave at the 2nd Apache Flink meetup in Washington DC Area hosted and sponsored by Capital One on November 19, 2015. You will quickly learn in step-by-step way:
How to setup and configure your Apache Flink environment?
How to use Apache Flink tools?
3. How to run the examples in the Apache Flink bundle?
4. How to set up your IDE (IntelliJ IDEA or Eclipse) for Apache Flink?
5. How to write your Apache Flink program in an IDE?
I used these slides to present the benefits of using Kotlin to a group of people I work with. The presentation focuses on comparing Kotlin to Java, and in particular showing how Kotlin can help in writing safer, more concise and readable code. I used a few java gotchas/puzzles to demonstrate how Kotlin may prevent us from doing silly things.
This presentation shortly describes key features of Apache Cassandra. It was held at the Apache Cassandra Meetup in Vienna in January 2014. You can access the meetup here: http://www.meetup.com/Vienna-Cassandra-Users/
Building RESTful applications using Spring MVCIndicThreads
REST is an alternate and simpler approach for implementing WebServices. It is based on the HTTP protocol and hence leverages a lot of existing infrastructures. It uses an uniform interface thus making it easy to build client applications. In this session we will look at the fundamental concepts behind REST (Resource, URI, Stateless Conversation ..) and how to apply it in the context of a real applcation. We will also discuss the pros & cons of RESTful vs Soap based webservices. We will discuss the design of RESTful application and then look at how to implement it using Spring MVC.
Fast federated SQL with Apache CalciteChris Baynes
This document discusses Apache Calcite, an open source framework for federated SQL queries. It provides an introduction to Calcite and its components. It then evaluates Calcite's performance on single data sources through benchmarks. Lastly, it proposes a hybrid approach to enable efficient federated queries using Calcite and Spark.
This is the presentation I made on JavaDay Kiev 2015 regarding the architecture of Apache Spark. It covers the memory model, the shuffle implementations, data frames and some other high-level staff and can be used as an introduction to Apache Spark
The document provides an overview of the activity feeds architecture. It discusses the fundamental entities of connections and activities. Connections express relationships between entities and are implemented as a directed graph. Activities form a log of actions by entities. To populate feeds, activities are copied and distributed to relevant entities and then aggregated. The aggregation process involves selecting connections, classifying activities, scoring them, pruning duplicates, and sorting the results into a merged newsfeed.
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Steve Pember
In this presentation we will present the general philosophy of Clean Architecture, Hexagonal Architecture, and Ports & Adapters: discussing why these approaches are useful and general guidelines for introducing them to your code. Chiefly, we will show how to implement these patterns within your Spring (Boot) Applications. Through a publicly available reference app, we will demonstrate what these concepts can look like within Spring and walkthrough a handful of scenarios: isolating core business logic, ease of testing, and adding a new feature or two.
Slides for presentation on ZooKeeper I gave at Near Infinity (www.nearinfinity.com) 2012 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/zookeeper-samples
Apache Hive 3 introduces new capabilities for data analytics including materialized views, default columns, constraints, and improved JDBC and Kafka connectors to enable real-time streaming and integration with external systems like Druid; Hive 3 also improves performance and query optimization through a new query result cache, workload management, and cloud storage optimizations. Data Analytics Studio provides self-service analytics on top of Hive 3 through a visual interface to optimize queries, monitor performance, and manage data lifecycles.
Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition! Michel Schudel
Micronaut and Quarkus are two cool emerging Java backend frameworks that aim to solve some problems that exist in current frameworks, like faster startup, low memory footprint, and support for ahead-of-time compilation using GraalVM. In this session, we'll square off both frameworks against each other.
How do they compare, what are the stronger and weaker points of both frameworks?
We'll compare the following features:
Initializing your project
Building your first restcontroller / programming model
Startup time
Database support
Integration test support
Building native images
Memory usage and JAR sizes
Ease of cloud deployment
In the end, we might have a clear winner! ... or will we?
The document discusses Long-Lived Application Process (LLAP), a new capability in Apache Hive that enables long-lived daemon processes to improve query performance. LLAP eliminates Hive query startup costs by keeping query execution engines alive between queries. It allows queries to leverage just-in-time optimization and data caching to enable interactive query performance directly on HDFS data. LLAP utilizes asynchronous I/O, in-memory caching, and a query fragment API to optimize query processing. It integrates with Apache Tez to coordinate query execution across long-lived daemon processes and traditional YARN containers.
How to Avoid Common Mistakes When Using Reactor NettyVMware Tanzu
The document discusses common mistakes when using Reactor Netty including logging, memory leaks, timeouts, connection closed issues, and connection pools. It provides examples of logging output that show a request-response lifecycle and handling of multiple concurrent connections. The presentation covers configuring logging, avoiding object retention, setting response timeouts, handling closed connections, and sizing connection pools properly.
Building resilient scheduling in distributed systems with SpringMarek Jeszka
It is common to have jobs running periodically, especially in asynchronous and distributed systems. If the service is scaled horizontally (i.e. there are multiple instances of the same service), you often only want a single node to handle the task.
In this session I will demonstrate how to manually setup Spring to have custom logic in scheduling configuration and perform recurring tasks only on a single node. This requires keeping notation of the leader and persisting the selection.
The key takeaway of this session is how to implement distributed locking and how simple it is to run Spring application on top of it. In this talk you will learn how to mitigate challenges that arise when you use traditional declarative approach for scheduling and how to switch to a more flexible programmatic approach.
Here is an analysis of variations in a red beetle population across three situations:
Situation 1 (Original population): The population consists of mostly red beetles, with a small percentage of black beetles. The red coloration provides better camouflage in their current environment.
Situation 2 (Environment change): The environment darkens due to increased vegetation/debris. Now black beetles have better camouflage than red beetles. Over time, the percentage of black beetles in the population will increase relative to red beetles, as black beetles survive and reproduce at a higher rate.
Situation 3 (New environment): The environment changes again, this time becoming lighter in color (e.g
This document provides definitions for 5000 academic words. It advertises an audio program that teaches these words in only 15 minutes per day for 4 weeks. It includes a free memory course. The definitions provided are brief and include parts of speech and examples of usage for some of the words.
The document discusses engaging students with technology and rethinking education. It addresses how technology can support literacy, community, and assessment. Some key ideas include using technology to personalize learning, connect students in multiple ways, and make assessment a conversation rather than just scores on a spreadsheet. The role of joy in education is also discussed.
Your guide to picking the right User Interface (UI) and creating the best User Experience (UX) in just a short amount of time. Learn how to quickly create mockups, landing pages, and build mock integrations that turn into large ideas.
Have more questions about UX/UI? Contact mvp@koombea.com for additional information or questions and we will get back to you shortly.
Overview on the Toyota production system principles, techniques and theories.
The presentation include:
-Lean Manufacturing Principles
-Productivity Measurement, Analysis and Improvement
-Effect & Elimination of the Manufacturing 7-Wastes
-Lean Improvement Techniques
-Lean Management for Making Improvement & Gaining Sustainability
How does a designer fit into an organization as a leader alongside their client service, project management, and financial management peers? Or, as happens in many cases, how does a solo designer, studio owner, or in-house group determines that fine balance between the health of the studio from an operational perspective and nurturing a strong creative vision that guides both the client work and the studio culture?
File three 4 am great expectations- with atf anf aef competenciesMr Bounab Samir
1) The document outlines a lesson plan focusing on developing students' ability to predict, give instructions, and form nouns of occupations using suffixes.
2) Key aspects of language covered include time clauses, vocabulary related to hopes and expectations, and suffixes.
3) Students will practice predicting, describing photos, listening for details, and noting what characters will do in the future based on a script.
Mathematics high school level quiz - Part IITfC-Edu-Team
The document outlines the format and questions for a mathematics quiz with multiple rounds. It begins with a two-part quiz where groups are given problem cards to solve. The subsequent rounds include warm-up questions testing concepts like geometry, averages, and number puzzles, as well as "real math" and logic rounds. Later rounds involve problem-solving, model-making to demonstrate algebraic identities, and a final written work discussion period.
PowerPoint Hacks for Rookies: 4 Must Consider Aspects24Slides
While there are many things you should consider to create a spectacular presentation, there are 4 non-negotiable aspects you should keep in mind first.
Anatomy of Brain by MRI
In this presentation we will discuss the cross sectional anatomy of brain. Then we will discuss the Most common diseases to be evaluated by brain imaging.
In my opinion this presentation is a road map for beginars.
The Ultimate Guide to Creating Visually Appealing ContentNeil Patel
From videos to infographics, I’m constantly leveraging visual media.
Can you guess why?
It’s because these visual content pieces are generating more backlinks than any other form of content I publish, which—in the long run—helps increase my search engine rankings and overall readership numbers.
So, how do you create these visual masterpieces? Well, this infographic should help you.
How to Make Awesome SlideShares: Tips & TricksSlideShare
Turbocharge your online presence with SlideShare. We provide the best tips and tricks for succeeding on SlideShare. Get ideas for what to upload, tips for designing your deck and more.
What we carry with us in our everyday lives and interactions is just as important for our success as our technical skills and achievements.
This is what I carry with me. What do YOU carry?
Slides designed and produced with Haiku Deck for iPad. Set your story free with Haiku Deck at http://www.haikudeck.com/
You can learn more about Jonathon Colman at http://www.jonathoncolman.org/
The document is a report by Techsauce, Thailand's leading tech publication, summarizing Thailand's startup ecosystem and investment trends from 2012-2017. Some key findings include:
- Total funding raised by Thai startups grew from $3.1 million in 2011-2012 to over $86 million in 2016.
- Popular categories of startups receiving investment included e-commerce/marketplaces, fintech, logistics, and payments.
- Major acquisitions of Thai startups have totaled over $108 million, with companies being acquired by firms from Southeast Asia, China, and other regions.
10 Ways to Win at SlideShare SEO & Presentation OptimizationOneupweb
Thank you, SlideShare, for teaching us that PowerPoint presentations don't have to be a total bore. But in order to tap SlideShare's 60 million global users, you must optimize. Here are 10 quick tips to make your next presentation highly engaging, shareable and well worth the effort.
For more content marketing tips: http://www.oneupweb.com/blog/
61 Beautiful & Inspirational Timeline Cover on FacebookConsonaute
The document repeatedly promotes using beautiful and inspirational covers on one's Facebook timeline. It provides the same message over 100 times, encouraging readers to decorate their Facebook profile with these types of covers.
The document provides a business quiz with 16 multiple choice questions covering topics such as companies that coined economic terms, automobile companies, airlines, technology companies, banks, and consumer brands. It tests knowledge of companies like Goldman Sachs, Tata, Bombay Stock Exchange, HP, Rolls Royce, KFC, and banks like SBI and HDFC. The questions cover industries, products, founding details and other notable business facts.
Not sure what to share on SlideShare?
SlideShares that inform, inspire and educate attract the most views. Beyond that, ideas for what you can upload are limitless. We’ve selected a few popular examples to get your creative juices flowing.
Groovy Domain Specific Languages - SpringOne2GX 2012Guillaume Laforge
Paul King, Andrew Eisenberg and Guillaume Laforge present about implementation of Domain-Specific Languages in Groovy, while at the SpringOne2GX 2012 conference in Washington DC.
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Guillaume Laforge
The document discusses Domain Specific Languages (DSLs) and their use in Groovy. It provides an introduction to DSLs, their goals, examples of technical and business DSLs, and pros and cons of using DSLs. The document also discusses various Groovy features that are useful for creating DSLs, such as optional typing, native syntax constructs, command chain expressions, and adding properties to numbers. Paul King and Guillaume Laforge are identified as presenters on DSLs in Groovy.
"Xapi-lang For declarative code generation" By James NelsonGWTcon
Xapi-lang is a Java parser enhanced with an XML-like syntax that can be used for code generation, templating, and creating domain-specific languages. It works by parsing code into an abstract syntax tree and then applying visitors to analyze and transform the AST to produce output. Examples shown include class templating, API generation from templates, and UI component generation. The document also discusses best practices for code generation and outlines plans for rebuilding the GWT toolchain to support GWT 3 and J2CL. It promotes a new company, Vertispan, for GWT support and consulting and introduces another project called We The Internet for building tools to improve political systems using distributed democracy.
A broad introduction to Java.
What is Java and where is it used
Programming Languages in the web development
What is Java and where is it used
OOP PRINCIPLES
JAVA SE, JRE, JDK
IDE’s
Where Java used in the “Real World”
This document provides an overview of Groovy, a dynamic language for the Java Virtual Machine. It discusses Groovy's features like properties, closures, and integration with Java. The document outlines what's new in Groovy 1.5, including Java 5 features like annotations and generics. It also covers how to integrate Groovy in applications using mechanisms like the GroovyShell and GroovyClassLoader. The presentation aims to help attendees learn about Groovy and how they can use it in their projects.
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGuillaume Laforge
The document is a presentation about Groovy and Grails. It discusses the history and goals of Groovy, a dynamic language for the JVM. It covers Groovy syntax and features like closures, builders for XML, Swing and Ant. The presentation also discusses how Groovy enables the creation of internal Domain Specific Languages through its meta-object protocol and dynamic nature.
Introducing BoxLang : A new JVM language for productivity and modularity!Ortus Solutions, Corp
Just like life, our code must adapt to the ever changing world we live in. From one day coding for the web, to the next for our tablets or APIs or for running serverless applications. Multi-runtime development is the future of coding, the future is to be dynamic. Let us introduce you to BoxLang.
Dynamic. Modular. Productive.
BoxLang redefines development with its dynamic nature, empowering developers to craft expressive and functional code effortlessly. Its modular architecture prioritizes flexibility, allowing for seamless integration into existing ecosystems.
Interoperability at its Core
With 100% interoperability with Java, BoxLang seamlessly bridges the gap between traditional and modern development paradigms, unlocking new possibilities for innovation and collaboration.
Multi-Runtime
From the tiny 2m operating system binary to running on our pure Java web server, CommandBox, Jakarta EE, AWS Lambda, Microsoft Functions, Web Assembly, Android and more. BoxLang has been designed to enhance and adapt according to it's runnable runtime.
The Fusion of Modernity and Tradition
Experience the fusion of modern features inspired by CFML, Node, Ruby, Kotlin, Java, and Clojure, combined with the familiarity of Java bytecode compilation, making BoxLang a language of choice for forward-thinking developers.
Empowering Transition with Transpiler Support
Transitioning from CFML to BoxLang is seamless with our JIT transpiler, facilitating smooth migration and preserving existing code investments.
Unlocking Creativity with IDE Tools
Unleash your creativity with powerful IDE tools tailored for BoxLang, providing an intuitive development experience and streamlining your workflow. Join us as we embark on a journey to redefine JVM development. Welcome to the era of BoxLang.
Covers what a schema registry is, and the importance of a shared contractual language (schemas) between consuming and producing services. Talk presented at the Big Data Analytics meetup in Sydney.
Sugar is a meta-programming language that provides a syntactic wrapper for other programming languages. It aims to have an easy to learn syntax that focuses on software architecture, readability, and expressiveness. Sugar translates code written in its syntax to commonly used languages like JavaScript, Python, and ActionScript by taking advantage of their common features while abstracting differences. It provides a full program representation through its LambdaFactory API to allow meta-programming capabilities like modifying or analyzing programs.
FLOW3 is a web application platform which uses Domain-Driven Design as its major underlying concept. This approach makes FLOW3 easy to learn and at the same time clean and flexible for complex projects. It features namespaces, has an emphasis on clean, object-oriented code and provides a seemless Doctrine 2 integration.
FLOW3 incorporates Dependency Injection in a way which lets you truly enjoy creating a stable and easy-to-test application architecture (no configuration necessary). Being the only Aspect-Oriented Programming capable PHP framework, FLOW3 allows you to cleanly separate cross-cutting concerns like security from your main application logic.
This tutorial takes you through an imaginary project from scratch. During the journey we’ll visit all important areas of the framework.
Philip Stehlik at TechTalks.ph - Intro to Groovy and GrailsPhilip Stehlik
This document provides an introduction to Groovy and Grails from Philip Stehlik, the CTO of Taulia. It discusses Taulia's use of Groovy and Grails from the beginning, their technology stack including REST, SOAP, and file exchange integrations. It also summarizes why Groovy is well-suited for their needs, providing details on Groovy's syntax and capabilities. The document concludes with an overview of Taulia's architecture, development process, and deployment practices.
The document provides security tips and best practices for building web applications in Go. It discusses Go's type system, concurrency model, and standard library features. It also summarizes common vulnerabilities like SQL injection and XSS, and recommends using parameterized queries and HTML escaping to prevent them. Finally, it highlights tools like Gorilla and Gin web frameworks, and techniques like rate limiting and secure cookies to build secure Go applications.
From the International PHP Conference (Spring Edition) 2012, in Berlin, Germany.
FLOW3 is a web application platform which uses Domain-Driven Design as its major underlying concept. This approach makes FLOW3 easy to learn and at the same time clean and flexible for complex projects. It features namespaces, has an emphasis on clean, object-oriented code and provides a seemless Doctrine 2 integration. FLOW3 incorporates Dependency Injection in a way which lets you truly enjoy creating a stable and easy-to-test application architecture (no configuration necessary). Being the only Aspect-Oriented Programming capable PHP framework, FLOW3 allows you to cleanly separate cross-cutting concerns like security from your main application logic. This tutorial takes you through an imaginary project from scratch. During the journey we’ll visit all important areas of the framework.
This document provides an agenda and overview for a Rust programming language hack and learn session hosted by Robert "Bob" Reyes of Mozilla Philippines. The session will cover installing Rust, a "Hello World" program, using the Cargo package manager, IDE support, variables and data types, and basic arithmetic functions. The target audience is people with some programming experience who want to learn Rust. Upcoming topics for Session #2 will include the Rust standard library, functions, conditional statements, loops, vectors, strings, concurrency, and error handling. Attendees are encouraged to use the hashtags #MozillaPH and #RustPH on social media and to approach the mentors with any questions during the session
This document discusses dependency injection (DI) and the g4 library for Android applications. It introduces g4 as an Android library that supports DI to reduce coupling between components. Key features of g4 mentioned include DI configuration via modules, resource injection via annotations, and traits for mixing in common behavior. Examples are provided of implementing DI with g4 and comparing DI approaches between Java and Scala.
Translation Markup Language makes it easy to internationalize and localize your mobile applications written in Objective C or Swift. Once you install TMLKit SDK, your app will be immediately connected to over 50,000 professional translators around the world.
This document provides a high-level summary of GraalVM and its capabilities for running applications and languages on the Java Virtual Machine. Specifically, it discusses how GraalVM allows running JavaScript, Python, Ruby, R, Java and C/C++ efficiently on the JVM through projects like Truffle and Substrate. It also summarizes GraalVM's polyglot capabilities for interoperability between languages and ahead-of-time compilation of Java into native binaries.
The document discusses Linked Process, an Internet-scale distributed computing framework that uses the eXtensible Messaging and Presence Protocol (XMPP) for communication between nodes. It allows any XMPP-enabled device to participate in distributed computing tasks. The Linked Process specification defines how nodes can submit jobs, check job status, and interact through virtual machines. This approach aims to support a more general-purpose and open distributed computing platform than existing grid systems.
The document discusses the rise of responsive single page applications (SPAs) built with HTML, CSS, JavaScript, and frameworks like AngularJS. It explains that SPAs are web apps that load on a single page like desktop apps, with content loaded asynchronously in the background without page reloads for a better user experience. SPAs are implemented using JavaScript and HTML, with ECMAScript as the standardized scripting language. The document also covers web standards defined by organizations like W3C, including HTML, CSS, XML, and how they are used to build responsive SPAs.
The document outlines Mark Proctor's journey working with Drools, jBPM and OptaPlanner over 20 years, including the evolution of the products from early Drools in 2000 to the current focus on cloud-native applications using Quarkus, GraalVM and Kubernetes. It also discusses recent efforts under the Submarine project to develop domain-specific services for decisions, processes, events and optimizations using a canonical executable model and polyglot capabilities. The engineering team for Drools and jBPM has quadrupled in size since 2011 to support these initiatives.
Similar to Going to Mars with Groovy Domain-Specific Languages (20)
The document discusses new features and enhancements in Groovy 2, including modularity improvements, extension modules, Java 7 support like invoke dynamic and binary literals, and static type checking. Modularity changes allow Groovy to be split into a smaller core JAR and optional modules. Extension modules allow contributing new methods. Static type checking adds compile-time checks for errors.
Fort de ses 1.7 millions de téléchargements l'an passé, Groovy continue son bonhomme de chemin en tête parmi les langages de programmation alternatifs pour la JVM.
Groovy 2.0, sorti l'an passé, introduisait dans son offre de la modularité, le support de JDK 7 au niveau syntaxique avec "Project Coin" autant qu'au niveau JVM avec l'utilisation d'"invoke dynamic", et proposait des fonctionnalités de typage et de compilation statique.
Groovy 2.1, quant à lui, s'appuie sur ces bases pour compléter le support d'"invoke dynamic" pour plus de performances. Il propose des améliorations permettant de documenter, d'aider les IDEs, et de vérifier statiquement les Domain-Specific Languages construits avec Groovy. Vous pourrez créer des méta-annotations regroupant d'autres annotations, pour éviter l'annotation "hell". Et enfin, vous irez encore plus loin dans la customisation du compilateur !
Accrochez votre ceinture, paré au décollage !
"Groovy 2.0 and beyond" presentation given at the Groovy/Grails eXchange conference.
Video can be seen here:
http://skillsmatter.com/podcast/groovy-grails/keynote-speech
Groovy 2.0 includes alignments with JDK 7, support for invoke dynamic, continued runtime performance improvements, static type checking, static compilation, and modularity. Some key features include command chains for more readable DSL code, closure enhancements, and bundled support for multicore programming with GPars.
This summary provides an overview of the key points about Groovy 2.0 discussed in the document:
1. Groovy 2.0 features a more modular architecture with smaller JAR files for individual features, as well as the ability to create custom extension modules.
2. It includes support for Java 7 features like binary literals, underscores in literals, and multicatch exceptions.
3. The new static type checking functionality in Groovy 2.0 aims to catch errors like typos, missing methods, and wrong assignments at compile time rather than runtime.
The document discusses new features in Groovy 2.0, including alignments with JDK 7 like Project Coin changes and invoke dynamic support, as well as static type checking, compilation, and modularity. It also covers improvements to Groovy 1.8 like command chains which allow dropping dots and parentheses when chaining method calls to write more readable code.
The document summarizes new features and enhancements in Groovy 2.0, including:
1) Command chains allow dropping dots and parentheses when chaining method calls to write more readable business rules.
2) Closure enhancements include annotation parameters, composition, trampolining, and improved memoization.
3) Builtin JSON support allows consuming, producing, and pretty-printing JSON.
Groovy 2.0 introduces several new features including command chains that allow dropping dots and parentheses when chaining method calls to write more readable DSL-style code. Other improvements include performance enhancements, built-in JSON support, and continued work on static type checking and static compilation.
The document discusses new features in Groovy 2.0 including alignments with JDK 7 such as Project Coin language changes and invoke dynamic support. It also discusses continued runtime performance improvements, static type checking, static compilation, and modularity. Additionally, the document provides an overview of improvements and enhancements to command chains, closures, and parallel programming support in Groovy 1.8.
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume LaforgeGuillaume Laforge
The document discusses new features in Groovy 1.8 and upcoming changes in Groovy 2.0. Key points include:
- Groovy 1.8 introduced "command chains" allowing method calls to be written without dots or parentheses for improved readability.
- Other Groovy 1.8 features included performance improvements, GPars for concurrency, and built-in JSON support.
- Groovy 2.0 will align more with JDK 7, add static type checking and compilation, and improve modularity.
The document discusses new features in Groovy 1.8 and upcoming features in Groovy 2.0, as presented by Guillaume Laforge, Groovy project manager. It introduces "command chains", which allow dropping dots and parentheses when chaining method calls to write more readable DSLs. It provides examples of command chains for medication instructions and making coffee. Upcoming features discussed for Groovy 2.0 include alignments with JDK 7, continued runtime performance improvements, static type checking, static compilation, and modularity.
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Guillaume Laforge
The document discusses new features in Groovy 1.8 including command chains that allow dropping dots and parentheses when chaining method calls, runtime performance improvements, and bundling of GPars for parallel programming. It also outlines plans for Groovy 2.0 such as alignments with JDK 7 including Project Coin and invokedynamic for continued runtime optimizations and static type checking.
The document discusses new features in Groovy 1.8 and beyond, including command chains expressions that allow dropping dots and parentheses when chaining method calls to write more readable domain-specific languages resembling plain English. It provides examples of medical instructions and coffee preparation written using this new syntax without punctuation. The author also outlines further syntax optimizations and control structures possible with command chains.
The document discusses Gaelyk, a lightweight Groovy toolkit for developing applications on Google App Engine Java. Gaelyk builds on Groovy's servlet support by allowing developers to write Groovlets instead of raw servlets and use Groovy templates. It provides enhancements to the GAE Java SDK by leveraging Groovy's dynamic nature. The document demonstrates how Gaelyk simplifies common tasks like sending emails, accessing and querying the datastore, and implementing MVC patterns using Groovlets and templates.
Groovy update - S2GForum London 2011 - Guillaume LaforgeGuillaume Laforge
Groovy Update: what's new in 1.8 and what's coming in 1.9
The Groovy Development team is releasing Groovy 1.8, and this session will cover the new features including improved support for advanced and readable Domain-Specific Languages thanks to Groovy 1.8's "Extended Command Expressions", new performance improvements in the area of integer arithmetics, built-in support for parsing and producing JSON payloads, new AST transformations and now GPars come already bundled.
Best Practices for Effectively Running dbt in Airflow.pdfTatiana Al-Chueyr
As a popular open-source library for analytics engineering, dbt is often used in combination with Airflow. Orchestrating and executing dbt models as DAGs ensures an additional layer of control over tasks, observability, and provides a reliable, scalable environment to run dbt models.
This webinar will cover a step-by-step guide to Cosmos, an open source package from Astronomer that helps you easily run your dbt Core projects as Airflow DAGs and Task Groups, all with just a few lines of code. We’ll walk through:
- Standard ways of running dbt (and when to utilize other methods)
- How Cosmos can be used to run and visualize your dbt projects in Airflow
- Common challenges and how to address them, including performance, dependency conflicts, and more
- How running dbt projects in Airflow helps with cost optimization
Webinar given on 9 July 2024
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Erasmo Purificato
Slide of the tutorial entitled "Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Emerging Trends" held at UMAP'24: 32nd ACM Conference on User Modeling, Adaptation and Personalization (July 1, 2024 | Cagliari, Italy)
How RPA Help in the Transportation and Logistics Industry.pptxSynapseIndia
Revolutionize your transportation processes with our cutting-edge RPA software. Automate repetitive tasks, reduce costs, and enhance efficiency in the logistics sector with our advanced solutions.
Are you interested in dipping your toes in the cloud native observability waters, but as an engineer you are not sure where to get started with tracing problems through your microservices and application landscapes on Kubernetes? Then this is the session for you, where we take you on your first steps in an active open-source project that offers a buffet of languages, challenges, and opportunities for getting started with telemetry data.
The project is called openTelemetry, but before diving into the specifics, we’ll start with de-mystifying key concepts and terms such as observability, telemetry, instrumentation, cardinality, percentile to lay a foundation. After understanding the nuts and bolts of observability and distributed traces, we’ll explore the openTelemetry community; its Special Interest Groups (SIGs), repositories, and how to become not only an end-user, but possibly a contributor.We will wrap up with an overview of the components in this project, such as the Collector, the OpenTelemetry protocol (OTLP), its APIs, and its SDKs.
Attendees will leave with an understanding of key observability concepts, become grounded in distributed tracing terminology, be aware of the components of openTelemetry, and know how to take their first steps to an open-source contribution!
Key Takeaways: Open source, vendor neutral instrumentation is an exciting new reality as the industry standardizes on openTelemetry for observability. OpenTelemetry is on a mission to enable effective observability by making high-quality, portable telemetry ubiquitous. The world of observability and monitoring today has a steep learning curve and in order to achieve ubiquity, the project would benefit from growing our contributor community.
Measuring the Impact of Network Latency at TwitterScyllaDB
Widya Salim and Victor Ma will outline the causal impact analysis, framework, and key learnings used to quantify the impact of reducing Twitter's network latency.
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfjackson110191
These fighter aircraft have uses outside of traditional combat situations. They are essential in defending India's territorial integrity, averting dangers, and delivering aid to those in need during natural calamities. Additionally, the IAF improves its interoperability and fortifies international military alliances by working together and conducting joint exercises with other air forces.
Quality Patents: Patents That Stand the Test of TimeAurora Consulting
Is your patent a vanity piece of paper for your office wall? Or is it a reliable, defendable, assertable, property right? The difference is often quality.
Is your patent simply a transactional cost and a large pile of legal bills for your startup? Or is it a leverageable asset worthy of attracting precious investment dollars, worth its cost in multiples of valuation? The difference is often quality.
Is your patent application only good enough to get through the examination process? Or has it been crafted to stand the tests of time and varied audiences if you later need to assert that document against an infringer, find yourself litigating with it in an Article 3 Court at the hands of a judge and jury, God forbid, end up having to defend its validity at the PTAB, or even needing to use it to block pirated imports at the International Trade Commission? The difference is often quality.
Quality will be our focus for a good chunk of the remainder of this season. What goes into a quality patent, and where possible, how do you get it without breaking the bank?
** Episode Overview **
In this first episode of our quality series, Kristen Hansen and the panel discuss:
⦿ What do we mean when we say patent quality?
⦿ Why is patent quality important?
⦿ How to balance quality and budget
⦿ The importance of searching, continuations, and draftsperson domain expertise
⦿ Very practical tips, tricks, examples, and Kristen’s Musts for drafting quality applications
https://www.aurorapatents.com/patently-strategic-podcast.html
Blockchain technology is transforming industries and reshaping the way we conduct business, manage data, and secure transactions. Whether you're new to blockchain or looking to deepen your knowledge, our guidebook, "Blockchain for Dummies", is your ultimate resource.
Transcript: Details of description part II: Describing images in practice - T...BookNet Canada
This presentation explores the practical application of image description techniques. Familiar guidelines will be demonstrated in practice, and descriptions will be developed “live”! If you have learned a lot about the theory of image description techniques but want to feel more confident putting them into practice, this is the presentation for you. There will be useful, actionable information for everyone, whether you are working with authors, colleagues, alone, or leveraging AI as a collaborator.
Link to presentation recording and slides: https://bnctechforum.ca/sessions/details-of-description-part-ii-describing-images-in-practice/
Presented by BookNet Canada on June 25, 2024, with support from the Department of Canadian Heritage.
Coordinate Systems in FME 101 - Webinar SlidesSafe Software
If you’ve ever had to analyze a map or GPS data, chances are you’ve encountered and even worked with coordinate systems. As historical data continually updates through GPS, understanding coordinate systems is increasingly crucial. However, not everyone knows why they exist or how to effectively use them for data-driven insights.
During this webinar, you’ll learn exactly what coordinate systems are and how you can use FME to maintain and transform your data’s coordinate systems in an easy-to-digest way, accurately representing the geographical space that it exists within. During this webinar, you will have the chance to:
- Enhance Your Understanding: Gain a clear overview of what coordinate systems are and their value
- Learn Practical Applications: Why we need datams and projections, plus units between coordinate systems
- Maximize with FME: Understand how FME handles coordinate systems, including a brief summary of the 3 main reprojectors
- Custom Coordinate Systems: Learn how to work with FME and coordinate systems beyond what is natively supported
- Look Ahead: Gain insights into where FME is headed with coordinate systems in the future
Don’t miss the opportunity to improve the value you receive from your coordinate system data, ultimately allowing you to streamline your data analysis and maximize your time. See you there!
Choose our Linux Web Hosting for a seamless and successful online presencerajancomputerfbd
Our Linux Web Hosting plans offer unbeatable performance, security, and scalability, ensuring your website runs smoothly and efficiently.
Visit- https://onliveserver.com/linux-web-hosting/
Implementations of Fused Deposition Modeling in real worldEmerging Tech
The presentation showcases the diverse real-world applications of Fused Deposition Modeling (FDM) across multiple industries:
1. **Manufacturing**: FDM is utilized in manufacturing for rapid prototyping, creating custom tools and fixtures, and producing functional end-use parts. Companies leverage its cost-effectiveness and flexibility to streamline production processes.
2. **Medical**: In the medical field, FDM is used to create patient-specific anatomical models, surgical guides, and prosthetics. Its ability to produce precise and biocompatible parts supports advancements in personalized healthcare solutions.
3. **Education**: FDM plays a crucial role in education by enabling students to learn about design and engineering through hands-on 3D printing projects. It promotes innovation and practical skill development in STEM disciplines.
4. **Science**: Researchers use FDM to prototype equipment for scientific experiments, build custom laboratory tools, and create models for visualization and testing purposes. It facilitates rapid iteration and customization in scientific endeavors.
5. **Automotive**: Automotive manufacturers employ FDM for prototyping vehicle components, tooling for assembly lines, and customized parts. It speeds up the design validation process and enhances efficiency in automotive engineering.
6. **Consumer Electronics**: FDM is utilized in consumer electronics for designing and prototyping product enclosures, casings, and internal components. It enables rapid iteration and customization to meet evolving consumer demands.
7. **Robotics**: Robotics engineers leverage FDM to prototype robot parts, create lightweight and durable components, and customize robot designs for specific applications. It supports innovation and optimization in robotic systems.
8. **Aerospace**: In aerospace, FDM is used to manufacture lightweight parts, complex geometries, and prototypes of aircraft components. It contributes to cost reduction, faster production cycles, and weight savings in aerospace engineering.
9. **Architecture**: Architects utilize FDM for creating detailed architectural models, prototypes of building components, and intricate designs. It aids in visualizing concepts, testing structural integrity, and communicating design ideas effectively.
Each industry example demonstrates how FDM enhances innovation, accelerates product development, and addresses specific challenges through advanced manufacturing capabilities.
7 Most Powerful Solar Storms in the History of Earth.pdfEnterprise Wired
Solar Storms (Geo Magnetic Storms) are the motion of accelerated charged particles in the solar environment with high velocities due to the coronal mass ejection (CME).
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Chris Swan
Have you noticed the OpenSSF Scorecard badges on the official Dart and Flutter repos? It's Google's way of showing that they care about security. Practices such as pinning dependencies, branch protection, required reviews, continuous integration tests etc. are measured to provide a score and accompanying badge.
You can do the same for your projects, and this presentation will show you how, with an emphasis on the unique challenges that come up when working with Dart and Flutter.
The session will provide a walkthrough of the steps involved in securing a first repository, and then what it takes to repeat that process across an organization with multiple repos. It will also look at the ongoing maintenance involved once scorecards have been implemented, and how aspects of that maintenance can be better automated to minimize toil.
YOUR RELIABLE WEB DESIGN & DEVELOPMENT TEAM — FOR LASTING SUCCESS
WPRiders is a web development company specialized in WordPress and WooCommerce websites and plugins for customers around the world. The company is headquartered in Bucharest, Romania, but our team members are located all over the world. Our customers are primarily from the US and Western Europe, but we have clients from Australia, Canada and other areas as well.
Some facts about WPRiders and why we are one of the best firms around:
More than 700 five-star reviews! You can check them here.
1500 WordPress projects delivered.
We respond 80% faster than other firms! Data provided by Freshdesk.
We’ve been in business since 2015.
We are located in 7 countries and have 22 team members.
With so many projects delivered, our team knows what works and what doesn’t when it comes to WordPress and WooCommerce.
Our team members are:
- highly experienced developers (employees & contractors with 5 -10+ years of experience),
- great designers with an eye for UX/UI with 10+ years of experience
- project managers with development background who speak both tech and non-tech
- QA specialists
- Conversion Rate Optimisation - CRO experts
They are all working together to provide you with the best possible service. We are passionate about WordPress, and we love creating custom solutions that help our clients achieve their goals.
At WPRiders, we are committed to building long-term relationships with our clients. We believe in accountability, in doing the right thing, as well as in transparency and open communication. You can read more about WPRiders on the About us page.
The DealBook is our annual overview of the Ukrainian tech investment industry. This edition comprehensively covers the full year 2023 and the first deals of 2024.
3. Guillaume Laforge
• Groovy Project Manager at VMware
•Initiator of the Grails framework
•Creator of the Gaelyk
and Caelyf toolkits
• Co-author of Groovy in Action
• Follow me on...
•My blog: http://glaforge.appspot.com
•Twitter: @glaforge
•Google+: http://gplus.to/glaforge
3
5. Domain-Specific Languages
• Wikipedia definition
{ }
A Domain-Specific Language is a programming
language or executable specification language that
offers, through appropriate notations and
abstractions, expressive power focused on, and usually
restricted to, a particular problem domain.
• In contrast to General Purprose Languages
• Also known as: fluent / human interfaces, language oriented programming,
little or mini languages, macros, business natural languages...
5
6. Technical examples
Glade XSLT
<?xml version="1.0"?> <?xml version="1.0"?>
<GTK-Interface> <xsl:stylesheetversion="1.0"
<widget> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<class>GtkWindow</class> <xsl:output method="xml"/>
<name>HelloWindow</name> <xsl:template match="*">
<border_width>5</border_width>
<Signal>
<xsl:element name="{name()}"> Regex
<xsl:for-each select="@*">
<name>destroy</name>
<handler>gtk_main_quit</handler>
<xsl:element name="{name()}">
<xsl:value-of select="."/>
"x.z?z{1,3}y"
</Signal>
<title>Hello</title> </xsl:element>
<type>GTK_WINDOW_TOPLEVEL</type> </xsl:for-each>
<position>GTK_WIN_POS_NONE</position> <xsl:apply-templates select="*|text()"/>
<allow_shrink>True</allow_shrink> </xsl:element>
<allow_grow>True</allow_grow> </xsl:template>
<auto_shrink>False</auto_shrink> </xsl:stylesheet>
<widget>
<class>GtkButton</class>
<name>Hello World</name>
<can_focus>True</can_focus>
fetchmail
<label>Hello World</label>
# Poll this site first each cycle.
</widget> poll pop.provider.net proto pop3
</widget> user "jsmith" with pass "secret1" is "smith" here
</GTK-Interface> user jones with pass "secret2" is "jjones" here with options keep
SQL # Poll this site second, unless Lord Voldemort zaps us first.
poll billywig.hogwarts.com with proto imap:
user harry_potter with pass "floo" is harry_potter here
SELECT * FROM TABLE
# Poll this site third in the cycle.
WHERE NAME LIKE '%SMI' # Password will be fetched from ~/.netrc
ORDER BY NAME poll mailhost.net with proto imap:
user esr is esr here
8. Goals of DSLs
• Use a more expressive language than a general-purpose one
• Share a common metaphor of understanding
between developers and subject matter experts
• Have domain experts help with the design
of the business logic of an application
• Avoid cluttering business code with too much boilerplate technical code
thanks to a clean separation
• Let business rules have their own lifecycle
8
9. Pros and cons
Pros Cons
• Domain experts can help, validate, • Learning cost vs. limited applicability
modify, and often develop DSL
programs
• Cost of designing, implementing &
maintaining DSLs as well as tools/IDEs
• Somewhat self-documenting
• Attaining proper scope
• Enhance quality, productivity,
• Trade-offs between domain specificity
reliability, maintainability, portability, and general purpose language
reusability constructs
• Safety; as long as the language
• Efficiency cost
constructs are safe, any DSL
sentence can be considered safe • Proliferation of similar
non-standard DSLs
9
10. Groovy provides...
• A flexible and malleable syntax
•scripts, native syntax constructs (list, map, ranges), closures, less punctuation...
• Compile-time and runtime meta-programming
•metaclasses, AST transformations
•also operator overloading
• The ability to easily integrate into Java / Spring apps
•also security and safety
10
17. More explicit direction
class!Robot!{
!!!!void)move(Direction!dir)!{}
}
enum!Direction!{
!!!!left,!right,!forward,!backward
}
17
18. Now how can we control it?
import)static)mars.Direction.*;
import)mars.Robot;
public)class)Command!{
))))public)static)void)main(String[]!args)!{
!!!!!!!!Robot!robot!=)new!Robot();
!!!!!!!!robot.move(left);
!!!!}
}
18
19. Now how can we control it?
import)static)mars.Direction.*;
import)mars.Robot;
public)class)Command!{
))))public)static)void)main(String[]!args)!{
!!!!!!!!Robot!robot!=)new!Robot();
!!!!!!!!robot.move(left);
!!!!}
} Syntactical
noise!
18
20. Now how can we control it?
))))))))))))))))))))))))))))))—
import)static)mars.Direction.*;
)))))))))))))))))—
import)mars.Robot;
——————————————————————
public)class)Command!{
))))————————————————————————————————————————
))))public)static)void)main(String[]!args)!{
))))))))—————))))))))))))))))))))—
!!!!!!!!Robot!robot!=)new!Robot();
))))))))))))))))))—))))——
!!!!!!!!robot.move(left);
))))—
!!!!}
—
} Syntactical
noise!
18
23. Scripts vs Classes
Optional semicolons & parens
import)static)mars.Direction.*
import)mars.Robot
Optional typing
!!!!!!!!def))!robot!=)new!Robot()
!!!!!!!!robot.move!left
But I don’t want to
compile a script for
every command!
19
26. GroovyShell to the rescue
def$shell%=$new%GroovyShell()
shell.evaluate(
%%%%new%File("command.groovy")
)
21
27. GroovyShell to the rescue
def$shell%=$new%GroovyShell()
shell.evaluate(
integration.groovy %%%%new%File("command.groovy")
)
21
28. GroovyShell to the rescue
def$shell%=$new%GroovyShell()
shell.evaluate(
integration.groovy %%%%new%File("command.groovy")
)
import$static$mars.Direction.*
import$mars.Robot
def$robot%=$new%Robot()
robot.move%left
21
29. GroovyShell to the rescue
def$shell%=$new%GroovyShell()
shell.evaluate(
integration.groovy %%%%new%File("command.groovy")
)
import$static$mars.Direction.*
import$mars.Robot
command.groovy
def$robot%=$new%Robot()
robot.move%left
21
30. Integration mechanisms
• Different solutions available:
•Groovy’s own mechanisms
• GroovyScriptEngine, Eval,
GroovyClassLoader, GroovyShell
•Java 6: javax.script.* / JSR-223
•
Groovy provides a JSR-223 implementation
•Spring’s lang namespace
• Groovy provides the highest level of flexibility
and customization, but JSR-223 is a standard...
22
31. Integration mechanisms
• Different solutions available:
•Groovy’s own mechanisms
• GroovyScriptEngine, Eval,
GroovyClassLoader, GroovyShell
•Java 6: javax.script.* / JSR-223
•
Groovy provides a JSR-223 implementation
•Spring’s lang namespace
• Groovy provides the highest level of flexibility
and customization, but JSR-223 is a standard...
22
33. What’s wrong with our DSL?
Can’t we hide
those imports?
import)static)mars.Direction.*
import)mars.Robot
def)robot!=)new!Robot()
robot.move!left
23
34. What’s wrong with our DSL?
Can’t we hide
those imports?
import)static)mars.Direction.*
import)mars.Robot
def)robot!=)new!Robot()
robot.move!left
Can’t we inject
the robot?
23
35. What’s wrong with our DSL?
Can’t we hide
those imports?
import)static)mars.Direction.*
import)mars.Robot
def)robot!=)new!Robot()
robot.move!left
Can’t we inject
Do we really need to the robot?
repeat ‘robot’?
23
39. Let’s inject a robot!
• We can pass data in / out of scripts through the Binding
•it’s basically just like a map of variable name keys and their associated values
26
40. Let’s inject a robot!
• We can pass data in / out of scripts through the Binding
•it’s basically just like a map of variable name keys and their associated values
def)binding!=)new!Binding([
!!!!robot:!new!Robot()
])
def)shell!=)new!GroovyShell(binding)
shell.evaluate(
!!!!new!File("command.groovy")
)
26
41. Let’s inject a robot!
• We can pass data in / out of scripts through the Binding
•it’s basically just like a map of variable name keys and their associated values
integration.groovy
def)binding!=)new!Binding([
!!!!robot:!new!Robot()
])
def)shell!=)new!GroovyShell(binding)
shell.evaluate(
!!!!new!File("command.groovy")
)
26
45. How to inject the direction?
• Using the binding...
def)binding!=)new!Binding([
!!!!robot:!new!Robot(),
!!!!left:!!!!!Direction.left,
!!!!right:!!!!Direction.right,
!!!!backward:!Direction.backward,
!!!!forward:!!Direction.forward
])
def)shell!=)new!GroovyShell(binding)
shell.evaluate(
!!!!new!File("command.groovy")
)
28
46. How to inject the direction?
Fragile in case of
new directions!
• Using the binding...
def)binding!=)new!Binding([
!!!!robot:!new!Robot(),
!!!!left:!!!!!Direction.left,
!!!!right:!!!!Direction.right,
!!!!backward:!Direction.backward,
!!!!forward:!!Direction.forward
])
def)shell!=)new!GroovyShell(binding)
shell.evaluate(
!!!!new!File("command.groovy")
)
28
47. How to inject the direction?
• Using the binding...
def)binding!=)new!Binding([
!!!!robot:!new!Robot(),
!!!!*:!Direction.values()
!!!!!!!!!!!!.collectEntries!{
!!!!!!!!!!!!!!!![(it.name()):!it]
!!!!!!!!!!!!}
])
def)shell!=)new!GroovyShell(binding)
shell.evaluate(
!!!!new!File("command.groovy")
)
29
48. How to inject the direction?
• Using compiler customizers...
• Let’s have a look at them
30
49. Compilation customizers
• Ability to apply some customization
to the Groovy compilation process
• Three available customizers
•ImportCustomizer: add transparent imports
•ASTTransformationCustomizer: injects an AST transform
•SecureASTCustomizer: restrict the groovy language to an allowed subset
• But you can implement your own
31
57. Secure AST customizer
Idea: Secure the rocket’s onboard trajectory
calculation system by allowing only math
expressions to be evaluated by the calculator
• Let’s setup our environment
•an import customizer to import java.lang.Math.*
•prepare a secure AST customizer
def%imports%=%new%ImportCustomizer().addStaticStars('java.lang.Math')
def%secure%=%new%SecureASTCustomizer()
36
62. Secure AST customizer You can build a subset of
the Groovy syntax!
...
//%language%tokens%allowed
tokensWhitelist%=%[
PLUS,%MINUS,%MULTIPLY,%DIVIDE,%MOD,%POWER,%PLUS_PLUS,%MINUS_MINUS,%
COMPARE_EQUAL,%COMPARE_NOT_EQUAL,%COMPARE_LESS_THAN,%COMPARE_LESS_THAN_EQUAL,%
COMPARE_GREATER_THAN,%COMPARE_GREATER_THAN_EQUAL
]
%
//%types%allowed%to%be%used%(including%primitive%types)
constantTypesClassesWhiteList%=%[
Integer,%Float,%Long,%Double,%BigDecimal,%
Integer.TYPE,%Long.TYPE,%Float.TYPE,%Double.TYPE
]
%
//%classes%who%are%allowed%to%be%receivers%of%method%calls
receiversClassesWhiteList%=%[%
Math,%Integer,%Float,%Double,%Long,%BigDecimal%]
}
...
38
63. Secure AST customizer You can build a subset of
the Groovy syntax!
...
//%language%tokens%allowed
tokensWhitelist%=%[
PLUS,%MINUS,%MULTIPLY,%DIVIDE,%MOD,%POWER,%PLUS_PLUS,%MINUS_MINUS,%
COMPARE_EQUAL,%COMPARE_NOT_EQUAL,%COMPARE_LESS_THAN,%COMPARE_LESS_THAN_EQUAL,%
COMPARE_GREATER_THAN,%COMPARE_GREATER_THAN_EQUAL
]
%
//%types%allowed%to%be%used%(including%primitive%types)
Black / white list
constantTypesClassesWhiteList%=%[ usage of classes
Integer,%Float,%Long,%Double,%BigDecimal,%
Integer.TYPE,%Long.TYPE,%Float.TYPE,%Double.TYPE
]
%
//%classes%who%are%allowed%to%be%receivers%of%method%calls
receiversClassesWhiteList%=%[%
Math,%Integer,%Float,%Double,%Long,%BigDecimal%]
}
...
38
64. Secure AST customizer
• Ready to evaluate our flight equations!
def%config%=%new%CompilerConfiguration()
config.addCompilationCustomizers(imports,%secure)
def%shell%=%new%GroovyShell(config)
%
shell.evaluate%'cos%PI/3'
• But the following would have failed:
shell.evaluate%'System.exit(0)'
39
69. How to remove the ‘robot’?
• Instead of calling the move() method on the robot
instance, we should be able to call the move() method
directly from within the script
• Two approaches:
• Inject a ‘move’ closure in the • Use a base script class with a
‘move’ method delegating to the
binding with a method pointer
robot
42
70. Inject a closure in the binding
def$robot%=%new%Robot()
binding%=$new%Binding([
%%%%robot:%robot,
%%%%*:%Direction.values()
%%%%%%%%%%%%.collectEntries%{
%%%%%%%%%%%%%%%%[(it.name()):%it]
%%%%%%%%%%%%},
%%%%move:%robot.&move
])
43
71. Inject a closure in the binding
def$robot%=%new%Robot()
binding%=$new%Binding([
%%%%robot:%robot,
%%%%*:%Direction.values()
%%%%%%%%%%%%.collectEntries%{
%%%%%%%%%%%%%%%%[(it.name()):%it]
%%%%%%%%%%%%},
%%%%move:%robot.&move
])
Method pointer (a closure) on
robot’s move instance method
43
72. Define a base script class
abstract)class!RobotBaseScriptClass!!!
!!!!!!!extends!Script!{
!!!!void!move(Direction!dir)!{
!!!!!!!!def)robot!=!this.binding.robot
!!!!!!!!robot.move!dir
!!!!}
}
44
73. Define a base script class
abstract)class!RobotBaseScriptClass!!!
!!!!!!!extends!Script!{
!!!!void!move(Direction!dir)!{
!!!!!!!!def)robot!=!this.binding.robot
!!!!!!!!robot.move!dir
!!!!}
}
The move() method is
now at the script level
44
74. Define a base script class
abstract)class!RobotBaseScriptClass!!!
!!!!!!!extends!Script!{
!!!!void!move(Direction!dir)!{
!!!!!!!!def)robot!=!this.binding.robot
!!!!!!!!robot.move!dir
!!!!}
}
The move() method is Access the robot through
now at the script level the script’s binding
44
75. Configure the base script class
def)conf)=)new)CompilerConfiguration()
conf.scriptBaseClass)=)RobotBaseScriptClass
45
76. Configure the base script class
def)conf)=)new)CompilerConfiguration()
conf.scriptBaseClass)=)RobotBaseScriptClass
Scripts evaluated with
this configuration will
inherit from that class
45
81. What we could do now is...
Mix of named and
normal parameters
move!left,!at:!3.km/h
49
82. What we could do now is...
Mix of named and
normal parameters
move!left,!at:!3.km/h
How to add a km
property to numbers?
49
83. Adding properties to numbers
• We need to:
• define units, distance and speed
• have a nice notation for them
• that’s where we add properties to numbers!
50
84. Unit enum and Distance class
enum$DistanceUnit%{
%%%%centimeter%('cm',%%%%0.01),
%%%%meter%%%%%%(%'m',%%%%1),%
%%%%kilometer%%('km',%1000)%
%%%%
%%%%String%abbreviation
%%%%double%multiplier
%%%%
%%%%Unit(String%abbr,%double%mult)%{
%%%%%%%%this.abbreviation%=%abbr
%%%%%%%%this.multiplier%=%mult%
%%%%}
%%%%String%toString()%{%abbreviation%}%
}
51
85. Unit enum and Distance class
@TupleConstructor%
enum$DistanceUnit%{ class%Distance%{
%%%%centimeter%('cm',%%%%0.01), %%%%double%amount%
%%%%meter%%%%%%(%'m',%%%%1),% %%%%DistanceUnit%unit
%%%%kilometer%%('km',%1000)%
%%%% %%%%String%toString()%{%
%%%%String%abbreviation %%%%%%%%"$amount%$unit"%
%%%%double%multiplier %%%%}%
%%%% }
%%%%Unit(String%abbr,%double%mult)%{
%%%%%%%%this.abbreviation%=%abbr
%%%%%%%%this.multiplier%=%mult%
%%%%}
%%%%String%toString()%{%abbreviation%}%
}
51
86. Different techniques
• To add dynamic methods or properties,
there are several approaches at your disposal:
• ExpandoMetaClass
• custom MetaClass
• Categories
• Let’s have a look at the ExpandoMetaClass
52
88. Using ExpandoMetaClass
Add that to
integration.groovy
Number.metaClass.getCm%=%{%f>%
%%%%new%Distance(delegate,%Unit.centimeter)%
}
Number.metaClass.getM%=%{%f>%
%%%%new%Distance(delegate,%Unit.meter)%
}
Number.metaClass.getKm%=%{%f>%
%%%%new%Distance(delegate,%Unit.kilometer)%
}
53
89. Using ExpandoMetaClass
Add that to
integration.groovy
Number.metaClass.getCm%=%{%f>%
%%%%new%Distance(delegate,%Unit.centimeter)%
}
Number.metaClass.getM%=%{%f>%
%%%%new%Distance(delegate,%Unit.meter)%
}
Number.metaClass.getKm%=%{%f>%
%%%%new%Distance(delegate,%Unit.kilometer)%
}
‘delegate’ is the
current number
53
90. Using ExpandoMetaClass
Add that to
integration.groovy Usage in
your DSLs
Number.metaClass.getCm%=%{%f>%
%%%%new%Distance(delegate,%Unit.centimeter)%
} 40.cm!
Number.metaClass.getM%=%{%f>%
%%%%new%Distance(delegate,%Unit.meter)%
3.5.m
} 4.km
Number.metaClass.getKm%=%{%f>%
%%%%new%Distance(delegate,%Unit.kilometer)%
}
‘delegate’ is the
current number
53
91. Distance okay, but speed?
• For distance, we just added a property access after the number,
but we now need to divide (‘div’) by the time
2.km/h
54
92. Distance okay, but speed?
• For distance, we just added a property access after the number,
but we now need to divide (‘div’) by the time
The div() method
on Distance
2.km/h
54
93. Distance okay, but speed?
• For distance, we just added a property access after the number,
but we now need to divide (‘div’) by the time
The div() method
on Distance
2.km/h
An h duration
instance in the binding
54
99. Operator overloading
• Update the Distance class with a div() method
following the naming convetion for operators
class%Distance%{
%%%%...
%%%%Speed%div(Duration%t)%{
%%%%%%%%new%Speed(this,%t)
%%%%}
%%%%...
}
59
100. Operator overloading
• Update the Distance class with a div() method
following the naming convetion for operators
class%Distance%{
%%%%...
%%%%Speed%div(Duration%t)%{
%%%%%%%%new%Speed(this,%t)
%%%%}
%%%%...
} Optional return
59
106. Named parameters usage
move!left,!at:!3.km/h
Normal Named
parameter parameter
Will call:
def!take(Map!m,!Direction!q)
61
107. Named parameters usage
move!left,!at:!3.km/h
Normal Named
parameter parameter
Will call:
def!take(Map!m,!Direction!q)
All named parameters go
into the map argument
61
108. Named parameters usage
move!left,!at:!3.km/h
Normal Named
parameter parameter
Will call:
def!take(Map!m,!Direction!q)
All named parameters go Positional parameters
into the map argument come afterwards
61
111. Named parameters usage
move!left,!at:!3.km/h
Can we get rid of What about the
the comma? colon too?
62
112. Command chains
• A grammar improvement in Groovy 1.8 allowing you
to drop dots & parens when chaining method calls
• an extended version of top-level statements like println
• Less dots, less parens allow you to
•write more readable business rules
•in almost plain English sentences
•
(or any language, of course)
63
146. Playing it safe...
• You have to think carefully about
what DSL users are allowed to do with your DSL
• Forbid things which are not allowed
•leverage the JVM’s Security Managers
•
this might have an impact on performance
•use a Secure AST compilation customizer
•
not so easy to think about all possible cases
•avoid long running scripts with *Interrupt transformations
74
147. Security Managers
• Groovy is just a language leaving on the JVM,
so you have access to the usual Security Managers mechanism
• Nothing Groovy specific here
• Please check the documentation on Security Managers
and how to design policy files
75
149. Controlling code execution
• Your application may run user’s code
•what if the code runs in infinite loops or for too long?
•what if the code consumes too many resources?
• 3 new transforms at your rescue
• @ThreadInterrupt: adds Thread#isInterrupted checks
so your executing thread stops when interrupted
• @TimedInterrupt: adds checks in method and closure bodies
to verify it’s run longer than expected
• @ConditionalInterrupt: adds checks with your own
conditional logic to break out from the user code
77
152. @TimedInterrupt
@TimedInterrupt(10)
import!groovy.transform.TimedInterrupt!
!
while!(true)!{
!!!!move!left
!!!!//!circle!forever
}
• InterruptedException thrown
when checks indicate code ran longer than desired
79
153. @ConditionalInterrupt
• Specify your own condition to be inserted
at the start of method and closure bodies
• check for available resources, number of times run, etc.
• Leverages closure annotation parameters from Groovy 1.8
@ConditionalInterrupt({$battery.level$<$O.1$})
import%groovy.transform.ConditionalInterrupt
100.times%{%%%%
%%%%move%forward%at%10.km/h
}
80
154. Using compilation customizers
• In our previous three examples, the usage of the interrupts were explicit,
and users had to type them
• if they want to deplete the battery of your robot,
they won’t use interrupts, so you have to impose interrupts yourself
• With compilation customizers you can inject those interrupts
thanks to the ASTTransformationCustomizer
81
156. Groovy Power!™
• A flexible and malleable syntax
• scripts vs classes, optional typing, colons and parens
• Groovy offers useful dynamic features for DSLs
• operator overloading, ExpandoMetaClass
• Can write almost plain natural language sentences
• for readable, concise and expressive DSLs
• Groovy DSLs are easy to integrate,
and can be secured to run safely in your own sandbox
83
157. Groovy Power!™ Groovy is a
great fit for
DSLs!
• A flexible and malleable syntax
• scripts vs classes, optional typing, colons and parens
• Groovy offers useful dynamic features for DSLs
• operator overloading, ExpandoMetaClass
• Can write almost plain natural language sentences
• for readable, concise and expressive DSLs
• Groovy DSLs are easy to integrate,
and can be secured to run safely in your own sandbox
83
158. And there’s more!
• We haven’t dived into...
•How to implement your own control structures with the help of closures
•How to create Groovy « builders »
•How to hijack the Groovy syntax to develop our own language extensions with
AST Transformations
•Source preprocessing for custom syntax
•How to use the other dynamic metaprogramming techniques available
•How to improve error reporting with customizers
•IDE support with DSL descriptors (GDSL and DSLD)
84
159. Thank you!
ge
e Lafor lopment
Gui llaum ovy Deve
Head of Gro
om
@ gmail.c
laforge rge
Email: g @glafo o/glaforg
e
Twitter : http://gplus.t spot.com
:
G oogle+ //glaforge.app
p:
B log: htt
85