Scala for Scripting implements a JSR-223 compliant scripting engine for Scala that runs on the OSGi platform. It allows Scala scripts to leverage existing tools like compilers, IDEs, and testing while also providing bindings to application objects. Some key challenges addressed include maintaining static types when passing arguments to scripts, bridging the Scala compiler and OSGi classloading, and caching compiled scripts for performance. The implementation is designed to be independent of Sling or OSGi through a configurable architecture.
This document provides an agenda and overview for a presentation on building RESTful web applications with Scala for Apache Sling. The presentation introduces Apache Sling, an OSGi-based web application framework and scripting layer for Java Content Repositories (JCR). It also introduces Scala, a multi-paradigm programming language for the Java Virtual Machine that is fully interoperable with Java. The presentation demonstrates how to build a sample forum application using Scala and Apache Sling by defining request handlers, rendering HTML, processing form submissions, and more.
The document discusses annotation processing and code generation. It describes using annotation processing to automatically generate retry logic for HTTP requests by creating a $$RetryStale interface with the same methods as the original interface but adding cache headers. The processing is done at compile time using the ProcessingEnvironment API to access elements, generate code with JavaPoet, and write the generated files. It recommends libraries like AutoService, Truth, and Compile testing to make annotation processors easier to write.
The document discusses the ServiceStack framework. It began as an enterprise .NET project in 2007 that followed Microsoft's prescribed enterprise SOA approach using technologies like WCF, BizTalk and CSF. This led to issues like brittle code-generated DTOs, services that needed to be deployed together, and slow development cycles. The ServiceStack framework was created to address these problems by focusing on code-first POCOs, lightweight high-performance implementations, and a test-driven development approach.
The ServiceStack framework originated from an enterprise .NET project in 2007 that followed Microsoft's prescribed enterprise SOA best practices at the time. This involved generating data transfer objects (DTOs) from XML schemas, using Windows Communication Foundation (WCF) web services, and other complex enterprise patterns. However, this led to brittle, infectious code that was difficult to develop and upgrade. ServiceStack was created to provide a simpler, faster, and more agile alternative to these complex enterprise patterns.
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...Julia Cherniak
In this talk, I’d like to show that engineer, in order to make progress, should develop its own “outside the box” thinking. Experienced programmer regardless of the language ought to look at things from various standpoints outside the commonly used paradigm. This allows her to choose the proper strategy which fits the task, customer’s requirements, saves time and money. Having our product as an example, I’d like to show new language and new methods, which are not that frequently used in the mainstream. I believe this will broaden the horizon of the conference audience.
The Ring programming language version 1.6 book - Part 42 of 189Mahmoud Samir Fayed
This document discusses using the Ring programming language to build web applications through CGI and provides examples of using the Web Library to create simple CGI programs. It covers configuring Apache to support Ring CGI files, a basic "Hello World" CGI program, and an example that builds a web form to accept user input via HTTP GET and displays the submitted values. The Web Library is introduced as a way to quickly generate HTML and handle HTTP requests in Ring.
Writing native bindings to node.js in C++nsm.nikhil
The document provides an overview of how to build a C/C++ link to the V8 JavaScript engine and Node.js in order to use C/C++ libraries and functions in Node.js. It discusses topics like initializing V8, handling handles, injecting primitives, defining functions and objects, adding methods, asynchronous I/O, and linking external libraries. Code examples are provided for basic functions, objects, inheritance using ObjectWrap, and asynchronous functions.
No REST for the Wicked: REST and CatalystJay Shirley
The document provides an overview of REST and how it can be implemented using the Catalyst framework in Perl. It discusses what REST is, how it leverages existing aspects of HTTP like verbs and status codes, and isn't a defined protocol but a set of best practices. It then describes the Catalyst::Action::REST module which makes it easy to build RESTful APIs in Catalyst and supports various serialization formats. Examples are given of performing CRUD operations via REST calls from the command line and how to handle this in browsers using JavaScript and YUI.
This document provides an agenda and overview for a presentation on building RESTful web applications with Scala for Apache Sling. The presentation introduces Apache Sling, an OSGi-based web application framework and scripting layer for Java Content Repositories (JCR). It also introduces Scala, a multi-paradigm programming language for the Java Virtual Machine that is fully interoperable with Java. The presentation demonstrates how to build a sample forum application using Scala and Apache Sling by defining request handlers, rendering HTML, processing form submissions, and more.
The document discusses annotation processing and code generation. It describes using annotation processing to automatically generate retry logic for HTTP requests by creating a $$RetryStale interface with the same methods as the original interface but adding cache headers. The processing is done at compile time using the ProcessingEnvironment API to access elements, generate code with JavaPoet, and write the generated files. It recommends libraries like AutoService, Truth, and Compile testing to make annotation processors easier to write.
The document discusses the ServiceStack framework. It began as an enterprise .NET project in 2007 that followed Microsoft's prescribed enterprise SOA approach using technologies like WCF, BizTalk and CSF. This led to issues like brittle code-generated DTOs, services that needed to be deployed together, and slow development cycles. The ServiceStack framework was created to address these problems by focusing on code-first POCOs, lightweight high-performance implementations, and a test-driven development approach.
The ServiceStack framework originated from an enterprise .NET project in 2007 that followed Microsoft's prescribed enterprise SOA best practices at the time. This involved generating data transfer objects (DTOs) from XML schemas, using Windows Communication Foundation (WCF) web services, and other complex enterprise patterns. However, this led to brittle, infectious code that was difficult to develop and upgrade. ServiceStack was created to provide a simpler, faster, and more agile alternative to these complex enterprise patterns.
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...Julia Cherniak
In this talk, I’d like to show that engineer, in order to make progress, should develop its own “outside the box” thinking. Experienced programmer regardless of the language ought to look at things from various standpoints outside the commonly used paradigm. This allows her to choose the proper strategy which fits the task, customer’s requirements, saves time and money. Having our product as an example, I’d like to show new language and new methods, which are not that frequently used in the mainstream. I believe this will broaden the horizon of the conference audience.
The Ring programming language version 1.6 book - Part 42 of 189Mahmoud Samir Fayed
This document discusses using the Ring programming language to build web applications through CGI and provides examples of using the Web Library to create simple CGI programs. It covers configuring Apache to support Ring CGI files, a basic "Hello World" CGI program, and an example that builds a web form to accept user input via HTTP GET and displays the submitted values. The Web Library is introduced as a way to quickly generate HTML and handle HTTP requests in Ring.
Writing native bindings to node.js in C++nsm.nikhil
The document provides an overview of how to build a C/C++ link to the V8 JavaScript engine and Node.js in order to use C/C++ libraries and functions in Node.js. It discusses topics like initializing V8, handling handles, injecting primitives, defining functions and objects, adding methods, asynchronous I/O, and linking external libraries. Code examples are provided for basic functions, objects, inheritance using ObjectWrap, and asynchronous functions.
No REST for the Wicked: REST and CatalystJay Shirley
The document provides an overview of REST and how it can be implemented using the Catalyst framework in Perl. It discusses what REST is, how it leverages existing aspects of HTTP like verbs and status codes, and isn't a defined protocol but a set of best practices. It then describes the Catalyst::Action::REST module which makes it easy to build RESTful APIs in Catalyst and supports various serialization formats. Examples are given of performing CRUD operations via REST calls from the command line and how to handle this in browsers using JavaScript and YUI.
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
The document discusses extending Ring by adding new classes and functions. It can be done by writing C/C++ code and compiling it into a DLL that can be loaded from Ring using LoadLib(). Functions defined in the DLL can then be called from Ring. Alternatively, RingQt classes can be extended by defining new classes that inherit from existing Qt classes. A code generator written in Ring is also presented that can automatically generate wrapper code to interface with external C/C++ libraries from Ring.
The POCO C++ Libraries are:
- A collection of C++ class libraries similar to Java Class Library, .NET Framework, and Cocoa.
- Focused on "internet-age" network-centric applications.
- Written in efficient, modern ANSI/ISO Standard C++ and based on the C++ Standard Library/STL.
- Highly portable and available on many different platforms.
- Open source and licensed under the Boost Software License, so completely free for both commercial and non-commercial use.
Intravert Server side processing for CassandraEdward Capriolo
The document provides examples of using CQL (Cassandra Query Language) to create and query tables in Cassandra. It shows how to create tables to store user and video data, insert sample records, and perform queries. It then discusses using the IntraVert library to execute more complex queries directly against Cassandra, such as joins, filters, and multi-table operations, in order to reduce network traffic and processing compared to doing everything on the client side.
Building Scalable, Distributed Job Queues with Redis and Redis::ClientMike Friedman
This document discusses using Redis and the Redis::Client Perl module to build scalable distributed job queues. It provides an overview of Redis, describing it as a key-value store that is simple, fast, and open-source. It then covers the various Redis data types like strings, lists, hashes, sets and sorted sets. Examples are given of how to work with these types using Redis::Client. The document discusses using Redis lists to implement job queues, with jobs added via RPUSH and popped via BLPOP. Benchmark results show the Redis-based job queue approach significantly outperforms using a MySQL jobs table with polling. Some caveats are provided about the benchmarks.
Innovative Specifications for Better Performance Logging and MonitoringCary Millsap
Imagine a car with no speedometer. There are speed limit signs and policemen all around with radar guns waiting to catch you speeding, but you have no way of knowing how fast you're going. Of course, a car like this has no openable hood (no bonnet), so to change the air filter, you have to hire a specialist to saw into the body of your car. A car like this would be preposterous. Yet people write software like this all the time.
The Oracle Database has some of the best performance logging features built into it of any software in the world. You can use it with any application—even applications that were built without logging and monitoring in mind. But you can go SO much further if you bother to include some performance logging features in your application. In this session, I explain Oracle's extended SQL tracing feature and describe how to enable and disable it. Then I show some innovative ideas that will help you design and build database applications that are easier to monitor, manage, and maintain throughout the software development life cycle.
Overview of The Scala Based Lift Web FrameworkIndicThreads
All of us having experience with other web frameworks such as Struts,Tapestry, Rails, etc would ask “Why another framework? Does Lift really solve problems any differently or more effectively than the ones we’ve used before? The Lift Web Framework provides an advanced set of tools for quickly and easily building real-time, multi-users, interactive web applications. Lift has a unique advantage that no other web framework currently shares: the Scala programming language. Scala is a relatively new language developed by Martin Odersky and his group at EPFL Switzerland. Scala is a hybrid Object Oriented and Functional language that runs at native speeds on the JVM and fully interoperates with Java code. Lift is a hybrid web framework built on Scala. Lift derives its features and idioms from the best of existing web frameworks as well as the functional and OO features in Scala. It compiles to Java bytecode and runs on the JVM, which means that we can leverage the vast ecosystem of Java libraries just as we would with any other java web framework. This presentation details the advantages of this Scala based Web framework over all the existing frameworks that we have used uptil now and shows a small sample application built with Lift. We will create a basic application with a model that maps to RDBMS, web pages that correspond to back end logic and bind dynamically created content to elements on the webpage.
The document discusses building lightweight web APIs with .NET using Nancy. It introduces Nancy and REST concepts like resources, representations, and HTTP verbs. It provides an example of building a RESTful order management API for a coffee shop called Restbucks using Nancy. The API allows clients to place, view, cancel, and pay for orders. Nancy provides a lightweight and readable way to build RESTful services that can be hosted in various environments and is easy to test.
The document describes Apache Hive hooks, which allow intercepting function calls or events during query execution in Hive. It provides details on the different hook points in Hive, including pre-execution, post-execution, and failure hooks. It also explains how to configure hooks by setting hook properties and the jar paths for hook implementations. Finally, it outlines the interfaces and contexts provided to hooks at each stage of query processing in Hive.
The Future of Java: Records, Sealed Classes and Pattern MatchingJosé Paumard
The release of the JDK 17 brings interesting features in the Java language: sealed types and pattern matching for switch. Along with the introduction of records, the implementation of pattern matching in the Java language begins to take shape. This presentation shows you how records, sealed types, and pattern matching can change the way we write Java code, on real patterns. It also shows you what we can expect to see on this topic in the future. It is mostly a live coding presentation, with some slides when the code is shown cannot be executed.
Liferay Mobile SDK has been enabling developers to create native apps backed by Liferay Portal’s power. We’ve been using it in production since 2013 and have noticed many improvement points. We also listened to the community and added new features that will make app development even faster. The new Liferay Mobile SDK for Android brings a lot of new features that boosts apps development. Things from automatic JSON parsing and RxJava compatibility to better code generation are ones of the improvements in this new major release.
The document describes what ServiceStack is and provides examples of its capabilities. It begins by asking what ServiceStack is, where it came from, and what it does. It then discusses how earlier attempts at SOA failed and what ServiceStack learned from those experiences. Key points are that ServiceStack focuses on message-based services, code-first POCOs, and maximum productivity. Examples show how ServiceStack simplifies common tasks like JSON serialization, ORM, caching, and more.
The Ring programming language version 1.5.2 book - Part 10 of 181Mahmoud Samir Fayed
The Natural Library allows defining languages that contain natural language commands in a text file. It parses the text file to understand commands written in English, Arabic, or other languages. This enables "natural programming" where programs can be written and understood using natural languages. For example, commands like "say hello" or "count from 1 to 5" in a text file can be parsed and executed by a program written in Ring using this library. The goal of natural languages for programming has existed, and Ring provides an innovative solution through the Natural Library.
This document provides an agenda and overview for a presentation on bridging the ESRI platform with Python and other databases. It discusses connection files in ESRI, using ArcPy cursors to read, insert and update data, connecting to databases like Oracle and SQL Server with Python libraries, and using SQLite as an alternative spatial database. It provides code examples for inserting CSV data into a SQLite database table and then inserting that data into a feature class. The final example shows updating data in a SQL Server database table.
Describing how to use Swift protocols to refactor obj-c networking layer to Swift while improving project architecture and test coverage. CocoaHeads-Berlin Sep 16
This document provides an overview of Scala-ActiveRecord, a type-safe Active Record model library for Scala. It discusses features such as being type-safe, having Rails ActiveRecord-like functionality, automatic transaction control, and support for associations and validations. The document also covers getting started, defining schemas, CRUD operations, queries, caching queries, validations, callbacks, and relationships.
Presentation from JVMLS 2015
One bottleneck in the Nashorn JavaScript engine is startup time. Nashorn, as it works currently in Java 8, JITs everything to Java bytecode, accruing overhead in code generation and class installation. Nashorn in Java 9, can in unfortunate cases, increase this compilation workload significantly, as the new optimistic type system, which has greatly increased steady state performance, requires more code invalidation on warmup. Based on our optimistic type compilation framework, which contains all the mechanisms for quick code replacement and on stack replacement on the bytecode level, I will present the new execution architecture we are developing. It will minimizes compile time intelligently, while maintaining or possible even increasing code performance, due to extra profiling and execution frequency information being passed to the JIT. I will also talk about what the future will bring in terms of other dynamic languages on the Nashorn engine, partial method compilation of hot paths and other intriguing possibilities that our new execution model opens up.
Its conciseness, versatility and DSL capabilities makes Scala desirable for scripting. In this report we show how we implemented a JSR223 compliant script engine for Scala which runs inside OSGi environments.
While the Scala compiler needs a class path to load class files, OSGi only provides class loaders. To overcome this we implemented a file system abstraction on top of OSGi bundles effectively providing a class path. Furthermore, JSR223's dynamic approach for passing arguments does not play well with Scala's static types. We need to make all types of arguments visible to scripts. Our implementation generates a preamble of adequate implicit conversions which allows scripts to use statically typed variables in a manner resembling dynamic types. Finally performance constraints require caching of pre-compiled scripts.
Apache Sling, an OSGi based web application framework with a scriptable application layer, uses our implementation for type safe templating via Scala's XML support.
Apache Sling is a web application framework which eases development of content centric applications. Sling is based on REST principles and uses a JCR content repository (JSR-170/JSR-283) for storage. Based on the JSR 223 specification (Scripting for the Java Platform) it integrates various scripting languages as OSGi bundles.
Scala is a scalable programming language for the JVM which is fully interoperable with Java. It is designed to express common programming patterns in a concise, elegant, and type safe way. Scala smoothly bridges the gap between object oriented and functional paradigms. Despite being strongly typed, Scala has the touch and feel of a genuine scripting language. It has the ability to infer types of expressions rather than relying on the programmer to explicitly declare them. Scala thus combines the best of the two worlds: flexible scripting and strong tool support e.g. documentation, safe refactoring and fail fast compilation. Its flexible syntax lets programmers easily define their own internal DSLs, effectively extending the language without leaving it.
This document provides an overview of a Dart workshop that teaches Dart fundamentals and building full-stack Dart applications. The workshop is divided into five parts that cover Hello World examples, integrating Google Maps, dynamic HTML, adding a server backend, and connecting to MongoDB. Each part includes tasks to complete and concepts to learn, such as the Dart project structure, writing unit tests, manipulating the DOM, making HTTP requests, and using the MongoDB Dart driver. The conclusion discusses why Dart may be better than JavaScript and considers if Dart has the potential to be the future for web development.
This document introduces GradleFx, a Flex build tool that uses Gradle. It discusses key features of GradleFx such as supporting SWC, SWF, and AIR compilation; tasks for cleaning, compiling, packaging, and testing; and conventions for project structure and dependencies. Advanced topics covered include compiler options, JVM arguments, dependency configurations, and additional steps for AIR projects and FlexUnit testing. An example Gradle build script is provided.
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
The document discusses extending Ring by adding new classes and functions. It can be done by writing C/C++ code and compiling it into a DLL that can be loaded from Ring using LoadLib(). Functions defined in the DLL can then be called from Ring. Alternatively, RingQt classes can be extended by defining new classes that inherit from existing Qt classes. A code generator written in Ring is also presented that can automatically generate wrapper code to interface with external C/C++ libraries from Ring.
The POCO C++ Libraries are:
- A collection of C++ class libraries similar to Java Class Library, .NET Framework, and Cocoa.
- Focused on "internet-age" network-centric applications.
- Written in efficient, modern ANSI/ISO Standard C++ and based on the C++ Standard Library/STL.
- Highly portable and available on many different platforms.
- Open source and licensed under the Boost Software License, so completely free for both commercial and non-commercial use.
Intravert Server side processing for CassandraEdward Capriolo
The document provides examples of using CQL (Cassandra Query Language) to create and query tables in Cassandra. It shows how to create tables to store user and video data, insert sample records, and perform queries. It then discusses using the IntraVert library to execute more complex queries directly against Cassandra, such as joins, filters, and multi-table operations, in order to reduce network traffic and processing compared to doing everything on the client side.
Building Scalable, Distributed Job Queues with Redis and Redis::ClientMike Friedman
This document discusses using Redis and the Redis::Client Perl module to build scalable distributed job queues. It provides an overview of Redis, describing it as a key-value store that is simple, fast, and open-source. It then covers the various Redis data types like strings, lists, hashes, sets and sorted sets. Examples are given of how to work with these types using Redis::Client. The document discusses using Redis lists to implement job queues, with jobs added via RPUSH and popped via BLPOP. Benchmark results show the Redis-based job queue approach significantly outperforms using a MySQL jobs table with polling. Some caveats are provided about the benchmarks.
Innovative Specifications for Better Performance Logging and MonitoringCary Millsap
Imagine a car with no speedometer. There are speed limit signs and policemen all around with radar guns waiting to catch you speeding, but you have no way of knowing how fast you're going. Of course, a car like this has no openable hood (no bonnet), so to change the air filter, you have to hire a specialist to saw into the body of your car. A car like this would be preposterous. Yet people write software like this all the time.
The Oracle Database has some of the best performance logging features built into it of any software in the world. You can use it with any application—even applications that were built without logging and monitoring in mind. But you can go SO much further if you bother to include some performance logging features in your application. In this session, I explain Oracle's extended SQL tracing feature and describe how to enable and disable it. Then I show some innovative ideas that will help you design and build database applications that are easier to monitor, manage, and maintain throughout the software development life cycle.
Overview of The Scala Based Lift Web FrameworkIndicThreads
All of us having experience with other web frameworks such as Struts,Tapestry, Rails, etc would ask “Why another framework? Does Lift really solve problems any differently or more effectively than the ones we’ve used before? The Lift Web Framework provides an advanced set of tools for quickly and easily building real-time, multi-users, interactive web applications. Lift has a unique advantage that no other web framework currently shares: the Scala programming language. Scala is a relatively new language developed by Martin Odersky and his group at EPFL Switzerland. Scala is a hybrid Object Oriented and Functional language that runs at native speeds on the JVM and fully interoperates with Java code. Lift is a hybrid web framework built on Scala. Lift derives its features and idioms from the best of existing web frameworks as well as the functional and OO features in Scala. It compiles to Java bytecode and runs on the JVM, which means that we can leverage the vast ecosystem of Java libraries just as we would with any other java web framework. This presentation details the advantages of this Scala based Web framework over all the existing frameworks that we have used uptil now and shows a small sample application built with Lift. We will create a basic application with a model that maps to RDBMS, web pages that correspond to back end logic and bind dynamically created content to elements on the webpage.
The document discusses building lightweight web APIs with .NET using Nancy. It introduces Nancy and REST concepts like resources, representations, and HTTP verbs. It provides an example of building a RESTful order management API for a coffee shop called Restbucks using Nancy. The API allows clients to place, view, cancel, and pay for orders. Nancy provides a lightweight and readable way to build RESTful services that can be hosted in various environments and is easy to test.
The document describes Apache Hive hooks, which allow intercepting function calls or events during query execution in Hive. It provides details on the different hook points in Hive, including pre-execution, post-execution, and failure hooks. It also explains how to configure hooks by setting hook properties and the jar paths for hook implementations. Finally, it outlines the interfaces and contexts provided to hooks at each stage of query processing in Hive.
The Future of Java: Records, Sealed Classes and Pattern MatchingJosé Paumard
The release of the JDK 17 brings interesting features in the Java language: sealed types and pattern matching for switch. Along with the introduction of records, the implementation of pattern matching in the Java language begins to take shape. This presentation shows you how records, sealed types, and pattern matching can change the way we write Java code, on real patterns. It also shows you what we can expect to see on this topic in the future. It is mostly a live coding presentation, with some slides when the code is shown cannot be executed.
Liferay Mobile SDK has been enabling developers to create native apps backed by Liferay Portal’s power. We’ve been using it in production since 2013 and have noticed many improvement points. We also listened to the community and added new features that will make app development even faster. The new Liferay Mobile SDK for Android brings a lot of new features that boosts apps development. Things from automatic JSON parsing and RxJava compatibility to better code generation are ones of the improvements in this new major release.
The document describes what ServiceStack is and provides examples of its capabilities. It begins by asking what ServiceStack is, where it came from, and what it does. It then discusses how earlier attempts at SOA failed and what ServiceStack learned from those experiences. Key points are that ServiceStack focuses on message-based services, code-first POCOs, and maximum productivity. Examples show how ServiceStack simplifies common tasks like JSON serialization, ORM, caching, and more.
The Ring programming language version 1.5.2 book - Part 10 of 181Mahmoud Samir Fayed
The Natural Library allows defining languages that contain natural language commands in a text file. It parses the text file to understand commands written in English, Arabic, or other languages. This enables "natural programming" where programs can be written and understood using natural languages. For example, commands like "say hello" or "count from 1 to 5" in a text file can be parsed and executed by a program written in Ring using this library. The goal of natural languages for programming has existed, and Ring provides an innovative solution through the Natural Library.
This document provides an agenda and overview for a presentation on bridging the ESRI platform with Python and other databases. It discusses connection files in ESRI, using ArcPy cursors to read, insert and update data, connecting to databases like Oracle and SQL Server with Python libraries, and using SQLite as an alternative spatial database. It provides code examples for inserting CSV data into a SQLite database table and then inserting that data into a feature class. The final example shows updating data in a SQL Server database table.
Describing how to use Swift protocols to refactor obj-c networking layer to Swift while improving project architecture and test coverage. CocoaHeads-Berlin Sep 16
This document provides an overview of Scala-ActiveRecord, a type-safe Active Record model library for Scala. It discusses features such as being type-safe, having Rails ActiveRecord-like functionality, automatic transaction control, and support for associations and validations. The document also covers getting started, defining schemas, CRUD operations, queries, caching queries, validations, callbacks, and relationships.
Presentation from JVMLS 2015
One bottleneck in the Nashorn JavaScript engine is startup time. Nashorn, as it works currently in Java 8, JITs everything to Java bytecode, accruing overhead in code generation and class installation. Nashorn in Java 9, can in unfortunate cases, increase this compilation workload significantly, as the new optimistic type system, which has greatly increased steady state performance, requires more code invalidation on warmup. Based on our optimistic type compilation framework, which contains all the mechanisms for quick code replacement and on stack replacement on the bytecode level, I will present the new execution architecture we are developing. It will minimizes compile time intelligently, while maintaining or possible even increasing code performance, due to extra profiling and execution frequency information being passed to the JIT. I will also talk about what the future will bring in terms of other dynamic languages on the Nashorn engine, partial method compilation of hot paths and other intriguing possibilities that our new execution model opens up.
Its conciseness, versatility and DSL capabilities makes Scala desirable for scripting. In this report we show how we implemented a JSR223 compliant script engine for Scala which runs inside OSGi environments.
While the Scala compiler needs a class path to load class files, OSGi only provides class loaders. To overcome this we implemented a file system abstraction on top of OSGi bundles effectively providing a class path. Furthermore, JSR223's dynamic approach for passing arguments does not play well with Scala's static types. We need to make all types of arguments visible to scripts. Our implementation generates a preamble of adequate implicit conversions which allows scripts to use statically typed variables in a manner resembling dynamic types. Finally performance constraints require caching of pre-compiled scripts.
Apache Sling, an OSGi based web application framework with a scriptable application layer, uses our implementation for type safe templating via Scala's XML support.
Apache Sling is a web application framework which eases development of content centric applications. Sling is based on REST principles and uses a JCR content repository (JSR-170/JSR-283) for storage. Based on the JSR 223 specification (Scripting for the Java Platform) it integrates various scripting languages as OSGi bundles.
Scala is a scalable programming language for the JVM which is fully interoperable with Java. It is designed to express common programming patterns in a concise, elegant, and type safe way. Scala smoothly bridges the gap between object oriented and functional paradigms. Despite being strongly typed, Scala has the touch and feel of a genuine scripting language. It has the ability to infer types of expressions rather than relying on the programmer to explicitly declare them. Scala thus combines the best of the two worlds: flexible scripting and strong tool support e.g. documentation, safe refactoring and fail fast compilation. Its flexible syntax lets programmers easily define their own internal DSLs, effectively extending the language without leaving it.
This document provides an overview of a Dart workshop that teaches Dart fundamentals and building full-stack Dart applications. The workshop is divided into five parts that cover Hello World examples, integrating Google Maps, dynamic HTML, adding a server backend, and connecting to MongoDB. Each part includes tasks to complete and concepts to learn, such as the Dart project structure, writing unit tests, manipulating the DOM, making HTTP requests, and using the MongoDB Dart driver. The conclusion discusses why Dart may be better than JavaScript and considers if Dart has the potential to be the future for web development.
This document introduces GradleFx, a Flex build tool that uses Gradle. It discusses key features of GradleFx such as supporting SWC, SWF, and AIR compilation; tasks for cleaning, compiling, packaging, and testing; and conventions for project structure and dependencies. Advanced topics covered include compiler options, JVM arguments, dependency configurations, and additional steps for AIR projects and FlexUnit testing. An example Gradle build script is provided.
Gradle is fast due to its incremental build system and concise domain-specific language (DSL) based on Groovy. The DSL allows configuring builds and tasks in a clear way. Gradle builds make heavy use of Groovy features like closures to define tasks and behaviors concisely.
This document discusses best practices for writing idiomatic Gradle plugins, including:
1. Making the plugin DSL readable, consistent, flexible and expressive.
2. Supporting the same Java versions as Gradle for compatibility.
3. Preferring methods over properties and using annotations properly.
4. Handling collections, maps, overriding dependencies, generated code, extensions and more idiomatically.
The document provides an introduction to Gradle, an open source build automation tool. It discusses that Gradle is a general purpose build system with a rich build description language based on Groovy. It supports "build-by-convention" and is flexible and extensible, with built-in plugins for Java, Groovy, Scala, web and OSGi. The presentation covers Gradle's basic features, principles, files and collections, dependencies, multi-project builds, plugins and reading materials.
The document provides an introduction to Gradle, an open source build automation tool. It discusses that Gradle is a general purpose build system with a rich build description language based on Groovy. It supports "build-by-convention" and is flexible and extensible, with built-in plugins for Java, Groovy, Scala, web and OSGi. The presentation covers Gradle's basic features, principles, files and collections, dependencies, multi-project builds, plugins and reading materials.
The document discusses Gradle, an open-source build automation tool. It provides an overview of Gradle's benefits such as scripting flexibility, incremental builds, and IDE project generation. It also covers key Gradle concepts like dependency management, testing, publishing artifacts, and custom tasks/plugins.
Groovy - Grails as a modern scripting language for Web applicationsIndicThreads
Dynamic scripting languages are a powerful addition to a software designer’s toolbox. Rails/Ruby and Python have not gained much acceptance in the enterprise. Grails and Groovy are an attempt to bridge the gap between the modern scripting world and the Enterprise Java world.
This talk is an introduction towards building web applications in Grails. First we will go about creating a REST based webservice. We will also show how to replace the default database backend of Grails with MySQL.
We will then build a web application that consumes this webservice. The emphasis will be on the design patterns and idioms in Grails that address the web application development lifecycle.
SeedStack business framework aims to make implementing DDD easier by providing a set of ready-to-use tactical building blocks along with common tasks automation and helpers.
These slides have been shown at the Zenika DDD NightClazz, the 19th of May 2016, in Paris.
What do you know about Page Object Pattern? Simon Stewart who first applied it in 2009 using the Selenium WebDriver. Next appear a helpful wrapper for Page Object, such as Page Element, ScreenPlay, LoadabLe Component and etc. If you are interested to see how the interface changed the presentation of the Page Object, look at this presentation
Lift provides a concise framework for developing web applications in Scala with features like convention over configuration, clean separation of presentation logic and content, and powerful AJAX and Comet support. It leverages the Scala programming language and has a responsive community. Code is more concise in Lift, increasing developer productivity.
Tornado is a Python web framework and asynchronous networking library. It is a scalable, non-blocking web server that allows applications to handle multiple requests simultaneously using a single thread. Some key features include lightweight and fast templates, asynchronous request handlers, and integrations with databases, caches and other services. Tornado is best suited for building real-time web services and can be used alongside other front-end web servers.
Using and scaling Rack and Rack-based middlewareAlona Mekhovova
Rack provides a standard interface between web servers and web applications. It allows a web application to return a status, headers, and a body in response to an HTTP request. Middleware can be plugged into a Rack application to modify requests and responses. Popular Rack middleware includes Rack::Cache, Rack::Middleware, and Warden for authentication. In Rails, middleware is configured through an initializer and plugged into the middleware stack to run before or after other middleware.
Developing application for Windows Phone 7 in TDDMichele Capra
A real example of how to develop an application for Windows Phone 7 with Test Driven Development approach. In this presentation you'll see also hoew to implements the Model-View-ViewModel (MVVM) pattern.
Sparkling Water integrates H2O fast scalable machine learning engine with Spark framework. The presentation introduces idea of Sparkling Water, gives technical details and presents live demo.
For more details, feel free to follow H2O Training Book at http://learn.h2o.ai
This document discusses several ways to extend Apache Spark, including defining custom data sources and UDFs (user-defined functions), customizing the Spark shell, UI, and adding new DDL commands. It provides code examples for customizing the Spark shell to print a custom welcome message, customizing the driver UI to add new tabs, and adding a new "PRINTME" DDL command to execute user-defined code. The document concludes by covering general principles for extending Spark such as inheriting from existing classes and supplying custom jars.
Groovygrailsnetbeans 12517452668498-phpapp03Kevin Juma
This document provides an overview of Groovy and the Grails web framework. It discusses how Groovy is a dynamic JVM language with Java-like syntax that integrates seamlessly with Java. It then explains that Grails is an open-source MVC framework built on Groovy that uses conventions over configuration. Key aspects of Grails like scaffolding, GORM, and GSP views are summarized. The document provides examples of Groovy and Grails code and outlines how to set up a basic Grails project and run a Grails application.
This document describes a performance pack for Adobe Experience Manager (AEM) 5.3 that includes fixes and optimizations to improve performance. It provides a roll-up of 61 hotfixes and feature packs focused on performance. Some key issues addressed include reducing memory usage for image processing, improving tag filtering speed, optimizing page expansion and asset permissions. Performance tests showed up to 3x faster speeds for common operations like importing images, opening the tag admin, and managing asset permissions.
The presentation discusses different strategies for testing software, including fuzz testing, code coverage, and using an in-memory database instead of a large database for testing. Fuzz testing involves sending random inputs to test error conditions, code coverage measures what code is and isn't tested, and an in-memory database like H2 Database is suggested for testing due to its small size, speed, and compatibility. The strategies aim to improve software quality and catch bugs through automated and repeatable testing.
The document discusses various persistence frameworks including SQL(++), O/R mapping frameworks like Hibernate, JDO, and JPA, and next generation frameworks like JaQu. It covers topics like dependencies, configuration, queries, and the risk of SQL injection when using traditional SQL approaches.
This document discusses OSGi and modularity in Java applications. It introduces OSGi as a solution for managing complexity and dynamic extensibility in Java applications. It then demonstrates a paint program example to showcase how OSGi allows for modular shapes to be dynamically deployed and configured at runtime. Key OSGi concepts are explained like bundles, services, and the OSGi framework. The document also introduces Apache Felix as a popular OSGi framework implementation.
The document discusses scripting Java applications using the Bean Scripting Framework (BSF) 3.0. It provides an overview of BSF 3.0, how to integrate scripting into Java applications using the Java Scripting API (JSR-223), and examples of using BSF with the Apache Sling project in an OSGi environment. It also demonstrates automatically registering a sample "Demo" scripting engine and interacting with scripts through variable bindings.
This document provides an overview and configuration details for TarPersistenceManager (TarPM) and clustering with TarPM in Adobe Experience Manager. TarPM is a disk-based persistence manager that uses standard tar files for efficient append-only operations. The document discusses TarPM functionality, configuration, optimization, hot backup, and migration. It also covers clustering architecture with a master node, global data store, cluster setup and configuration for both the repository and workspace levels.
The document summarizes the agenda for the European TechSummit 08 conference. It discusses the Day Support Initiative which includes introducing new collaboration features for customers and partners. It outlines phases to improve support through a knowledge base, forum, and improved ticket handling. It describes the roles and goals of the Support Lead and encourages attendees to help improve support by submitting fully qualified support tickets.
The document discusses using the Java Content Repository (JCR) specification and REST web services to build non-CMS web applications that access content in a flexible and standardized way. It provides an overview of JCR and how the Apache Sling framework uses JCR and REST to easily create dynamic websites and applications using content from a JCR-compliant repository without the need for server-side programming. Code snippets are included that demonstrate performing basic CRUD operations on content from a JCR repository using RESTful URLs and JavaScript.
Lars Trieloff is a product manager for Day's digital asset management (DAM) system. He discusses how DAM is built on Day's Communiqué platform using Sling, OSGi, and the CRX repository. DAM provides features like rich media handling, extensibility through OSGi bundles, and integration with existing Communiqué applications. Developers can customize DAM by creating new OSGi bundles or using the scripting API.
The document summarizes a technical summit presentation on dispatcher and out of memory issues in Day. It discusses the basics of dispatchers, how they handle requests and cache content. It also covers best practices for dispatchers and a new permission sensitive caching feature. For out of memory issues, it describes symptoms, potential causes, measures to diagnose the problem, analysis techniques using heap dumps, and how to report issues to DayCare support.
Lars Trieloff presented on advanced collaboration tools available now for Communiqué, including blogs, wikis and calendars. The presentation described features of each tool and provided examples of how they can be used for internal collaboration or public engagement. Trieloff concluded by previewing the next generation of collaboration with Social Collab, which will integrate social networking, gadgets, OpenID and microformats.
This document provides an agenda and overview of CQ WCM and Connectors. It discusses upcoming releases of CQ WCM that will include features like author clustering, faceted search, and theme support. It also outlines Day's connector architecture, which uses JCR connectors to enable access to legacy content repositories via the JCR API and integrate them into the Day content infrastructure. A demo will show CQ WCM and connector capabilities.
Jackrabbit is an open source content repository. The presenter discussed its release history and roadmap for short, medium, and long term issues and improvements. Key points include transitioning to component releases, working on JCR 2.0, priorities for 1.5 like a content explorer and connection pooling, JCR 2.0 support as part of 2.0, and long term goals including advanced features like clustering and point-in-time recovery.
The document compares the document type definitions DocBook and DITA. DocBook is hierarchical and focused on books, while DITA separates content from context and is topic-oriented. Key differences include DITA being more extensible and specialized, while DocBook has a larger set of predefined elements. Compatibility between the two standards is growing, but each may be more suitable depending on factors like project size, budget and timeline.
The document compares the document type definitions DocBook and DITA. DocBook is hierarchical and focused on books, while DITA separates content from context and is topic-oriented. Key differences include DITA being more extensible and specialized, while DocBook has a larger set of predefined elements. Compatibility between the two standards is growing, but each may be more suitable depending on factors like project size, budget and timeline.
This document provides an overview of Apache Jackrabbit, an open source content repository system that implements the Java Content Repository (JCR) specification. It discusses Jackrabbit's features such as content modeling, references and search capabilities, advanced features like versioning and personalization, and best practices for using Jackrabbit. The presentation aims to provide an engineering perspective on using Jackrabbit for managing content in applications.
Apache Sanselan is a pure Java image library that allows reading and writing of various image formats as well as extracting image metadata. It was initiated in 2004 as an open source project under the Apache license. Sanselan provides a portable, correct, and simple API for working with images from byte arrays or input streams without being tied to files. It supports identifying file formats, quickly extracting image information without reading the full image, and reading/writing common formats like PNG, GIF, TIFF and BMP.
This document discusses content management using Apache Jackrabbit, a Java Content Repository implementation. It provides an agenda for the discussion, including an overview of JCR and Jackrabbit, content modeling techniques, using references and search features, and a sample music application to demonstrate JCR capabilities. The document concludes with opening the discussion to questions.
This document provides an overview of Apache iBatis, an object-relational mapping tool for Java. It discusses why iBatis was created as a lighter-weight alternative to full-featured ORM solutions. The document then covers the basic steps to use iBatis, including writing Java objects, mapping configurations, database configurations, and application code. It also discusses key iBatis concepts like parameterized queries, result mappings, and using primitive types, beans, maps, or inline parameters.
This document summarizes how Apache Sling works for request processing. Sling uses a ResourceResolver to retrieve a Resource (like a JCR node) from the URI. A ServletResolver or ScriptResolver are then used to find and execute the appropriate Servlet or script to handle the request. Scripts are resolved by converting the Resource Type to a path and combining it with selectors and the request method/MIME type. Sling has no dependency on JCR and is modular and configurable via its use of OSGi. It comes in two flavors: microsling for simple deployments, and Sling which uses OSGi bundles for more flexibility.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
“An Outlook of the Ongoing and Future Relationship between Blockchain Technologies and Process-aware Information Systems.” Invited talk at the joint workshop on Blockchain for Information Systems (BC4IS) and Blockchain for Trusted Data Sharing (B4TDS), co-located with with the 36th International Conference on Advanced Information Systems Engineering (CAiSE), 3 June 2024, Limassol, Cyprus.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
1. Scala for Scripting
Implementing an OSGi enabled, JSR-223 compliant scripting engine for Scala
http://people.apache.org/~mduerig/scala4scripting/
Michael Dürig
michael.duerig@day.com
Day Software AG
http://www.day.com/
Scala Days 2010
April 15th
1
2. Agenda
■ Introduction
– Scripting with Scala
– Scala for Apache Sling
■ Requirements and goals
■ Challenges and solutions
■ Conclusion
2
3. Scripting with Scala
■ (Illusion of) executing source code
■ Concise and versatile*
var capitals = Map("Switzerland" -> "Bern", "Spain" -> "Madrid")
capitals += ("France" -> "Paris")
val c = capitals.find(_._1 == "France")
.map(_._2)
.getOrElse("NIL")
■ DSL capabilities
■ Type safe
*) Adapted from: Programming in Scala, Martin Odersky, Lex Spoon, Bill Venners. Artima, 2008. 3
4. Scripting with Scala (cont.)
■ XML literals: type safe templating
<html>
<head>
<link rel="stylesheet" href="/apps/forum/static/blue.css" />
</head>
<body>
<div id="Header">
Welcome to the { node("name") } forum
{ Calendar.getInstance.getTime }
</div>
<div id="Content">
{ SearchBox.render(request) }
{ ThreadOverview.render(node) }
</div>
</body>
</html>
4
5. Apache Sling
■ Web application framework
– Backed by a Java content repository (JSR-170/JSR-283):
Apache Jackrabbit
– Based on OSGi: Apache Felix
– http://sling.apache.org/
■ RESTful
– Content resolution for mapping request URLs to resources
(i.e. JCR nodes)
– Servlet resolution for mapping resources to request handlers
(i.e. scripts)
■ Scriptable application layer
– JSR-223: Scripting for the Java platform
5
9. Sling URL decomposition
GET /forum/scala4sling.html HTTP/1.1
Repository path
Application
selection
X
10. Sling URL decomposition
GET /forum/scala4sling.html HTTP/1.1
Repository path Script selection
Application
selection
X
11. Scala for Sling
package forum
class html(args: htmlArgs) {
import args._
// further imports omitted
println {
<html>
<body>
<div id="Header">
Welcome to the { node("name") } forum
{ Calendar.getInstance.getTime }
</div>
<div id="Content">
{ SearchBox.render(request) }
{ ThreadOverview.render(node) }
</div>
</body>
</html>
}
}
6
12. Scala for Sling
package forum
class html(args: htmlArgs) {
import args._ Import bindings
// further imports omitted
println {
<html>
<body>
<div id="Header">
Welcome to the { node("name") } forum
{ Calendar.getInstance.getTime }
</div>
<div id="Content">
{ SearchBox.render(request) }
{ ThreadOverview.render(node) }
</div>
</body>
</html>
}
}
6
13. Scala for Sling
package forum
class html(args: htmlArgs) {
import args._ Import bindings
// further imports omitted
println {
<html>
<body>
<div id="Header">
Welcome to the { node("name") } forum
{ Calendar.getInstance.getTime }
</div>
Use arguments
<div id="Content">
{ SearchBox.render(request) }
{ ThreadOverview.render(node) }
</div>
</body>
</html>
}
}
6
14. Agenda
■ Introduction
■ Requirements and goals
– JSR-223 compliance
– OSGi tolerant
– Further design goals
■ Challenges and solutions
■ Conclusion
7
15. JSR-223
■ Scripting for the Java language
– Allow scripts access to the Java Platform
– Scripting for Java server-side applications
– Executing scripts:
javax.script.{ScriptEngine, ScriptEngineFactory}
– Binding application objects into scripts:
javax.script.Bindings
8
16. JSR-223: usage
val factories = ServiceRegistry.lookupProviders(classOf[ScriptEngineFactory])
val factory = factories.find(_.getEngineName == "Scala Scripting Engine")
val engine = factory.map(_.getScriptEngine).getOrElse {
throw new Error("Cannot locate Scala scripting engine")
}
val bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE)
bindings.put("request", servletRequest)
engine.eval(script, bindings)
9
17. OSGi
■ OSGi Service Platform
– Runtime environment for Java applications (bundles)
– Module system
– Life cycle management
– Service registry
■ Mostly transparent
– Bundle information in manifest file
– Relies on class loading
10
18. Further design goals
■ Leverage existing tools
– Compilers
– IDEs
– Test suites
– Documentation and reporting tools
■ Independent from Sling and OSGi
– Versatile
– Configurable
– Embeddable
11
19. Agenda
■ Introduction
■ Requirements and goals
■ Challenges and solutions
– Leverage existing tools
– Passing arguments to scripts
– Scalac and OSGi
– Performance
■ Conclusion
12
20. Leverage existing tools
■ Scripts are valid Scala source entities
■ Tradeoff
– ceremony
package forum
class html(args: htmlArgs) {
import args._
// ...
}
■ Advantages
– Write, refactor and debug with Scala IDEs
– Compile with Scala compiler
– Unit testing
13
21. Unit testing
class html(args: htmlArgs) {
import args._
// further imports omitted
println {
<html>
<body>
<div id="Header">
Welcome to the { node("name") } forum
{ Calendar.getInstance.getTime }
</div>
<div id="Content">
{ SearchBox.render(request) }
{ ThreadOverview.render(node) }
</div>
</body>
</html>
}
}
14
22. Unit testing
class html(args: htmlArgs) {
import args._ class htmlArgs {
// further imports omitted
val node = new {
println { def apply(name: String) = "Scala scripting"
<html>
<body> }
<div id="Header"> val request = new { /* ... */ }
Welcome to the { node("name") } forum
{ Calendar.getInstance.getTime } }
</div>
<div id="Content">
{ SearchBox.render(request) } new html(new htmlArgs)
{ ThreadOverview.render(node) }
</div>
</body>
</html>
}
}
14
23. Unit testing
class html(args: htmlArgs) {
import args._ class htmlArgs {
// further imports omitted
val node = new {
println { def apply(name: String) = "Scala scripting"
<html>
<body> }
<div id="Header"> val request = new { /* ... */ }
Welcome to the { node("name") } forum
{ Calendar.getInstance.getTime } }
</div>
<div id="Content">
{ SearchBox.render(request) } new html(new htmlArgs)
{ ThreadOverview.render(node) }
</div>
</body>
</html>
}
<html>
} <body>
<div id="Header">
Welcome to the Scala scripting forum
Tue Mar 16 19:46:38 CET 2010
</div>
<div id="Content">
<!-- output omitted -->
</div>
</body>
</html>
14
24. Passing arguments to Scripts
class ResettableOutStream extends OutputStream implements Resettable {
public void write(int b) throws IOException { /* ... */ }
public void reset() { /* ... */ }
}
OutputStream getResetableOutputStream() { /* ... */ }
bindings.put("output", getResetableOutputStream)
engine.eval(script, bindings)
class html(args: htmlArgs) {
import args._
output.write(‘c’)
output.reset()
}
15
25. Passing arguments to Scripts
class ResettableOutStream extends OutputStream implements Resettable {
public void write(int b) throws IOException { /* ... */ }
public void reset() { /* ... */ }
}
OutputStream getResetableOutputStream() { /* ... */ }
bindings.put("output", getResetableOutputStream)
engine.eval(script, bindings)
Where are the types?
class html(args: htmlArgs) {
import args._
output.write(‘c’)
output.reset()
}
15
26. Passing arguments to Scripts
class ResettableOutStream extends OutputStream implements Resettable {
public void write(int b) throws IOException { /* ... */ }
public void reset() { /* ... */ }
}
OutputStream getResetableOutputStream() { /* ... */ }
bindings.put("output", getResetableOutputStream)
engine.eval(script, bindings)
Where are the types?
class html(args: htmlArgs) {
import args._
Bindings wrapper
output.write(‘c’)
provides static types
output.reset()
}
15
27. Bindings wrapper
■ No type information in javax.script.Bindings
– Generate bindings wrapper exposing static types
– Arguments appear to be of all accessible types
– Implicit conversions to the rescue
■ Least accessible types
– v: C, I1, ..., In
– Expose v with static type D of least accessible super type of C
– Expose v through implicit conversion to Ik if neither D nor any Im
(m ≠ k) implements Ik.
16
28. Bindings wrapper (cont.)
class ResettableOutStream extends OutputStream implements Resettable {
public void write(int b) throws IOException { /* ... */ }
public void reset() { /* ... */ }
}
OutputStream getResetableOutputStream() { /* ... */ }
bindings.put("output", new ResettableOutStream)
engine.eval(script, bindings)
17
29. Bindings wrapper (cont.)
class ResettableOutStream extends OutputStream implements Resettable {
public void write(int b) throws IOException { /* ... */ }
public void reset() { /* ... */ }
}
OutputStream getResetableOutputStream() { /* ... */ }
bindings.put("output", new ResettableOutStream)
engine.eval(script, bindings)
Bindings wrapper
class htmlArgs(bindings: Bindings) {
lazy val output = bindings.getValue("output").asInstanceOf[OutputStream]
implicit def outputStream2Resettable(x: OutputStream): Resettable =
x.asInstanceOf[Resettable]
}
17
30. Bindings wrapper (cont.)
class ResettableOutStream extends OutputStream implements Resettable {
public void write(int b) throws IOException { /* ... */ }
public void reset() { /* ... */ }
}
OutputStream getResetableOutputStream() { /* ... */ }
bindings.put("output", new ResettableOutStream)
engine.eval(script, bindings)
Bindings wrapper
class htmlArgs(bindings: Bindings) {
lazy val output = bindings.getValue("output").asInstanceOf[OutputStream]
implicit def outputStream2Resettable(x: OutputStream): Resettable =
x.asInstanceOf[Resettable]
}
17
31. Bindings wrapper (cont.)
■ Limitations
– Scala’s visibility modifiers not exposed through reflection
– Not yet working with parametrized types
– Ambiguities in generated implicit conversion
18
32. Scalac and OSGi
■ Scalac
– Requires compiler class path
– File system based
■ OSGi
– Provides class loaders
– Bundle based
■ Bridging the gap
– File system abstraction over OSGi bundles
– Implement scala.tools.nsc.io.AbstractFile
– Limitation: wiring probably not fully respected
19
33. Independent through configuration
■ Abstract implementation details into configuration class
– Default implementation for standalone usage
– Specialized implementations for Sling
– Set through ScriptEngineFactory or injected via OSGi service
lookup
X
34. Configuration
■ Scala compiler
– Per script engine
– scripting.scala.SettingsProvider
– Class and output paths: scala.tools.nsc.io.AbstractFile
– Settings: scala.tools.nsc.Settings
– Reporting: scala.tools.nsc.reporters.Reporter
■ Script entry point
– Per invocation
– scripting.scala.ScriptInfo
X
35. Performance
■ On the fly compilation is slow
– Cache pre compiled scripts
– Dependency on bindings: include bindings wrapper
– Work in progress
20
36. Conclusion
■ Scala is attractive for scripting
– Concise and versatile
– DSL capabilities
– Type safe
– XML literals for type safe templating
■ Impedance mismatches
– JSR-223: dynamic vs. static typing
– OSGi: runtime environment vs. compile time utility
– Performance: illusion of executing source code
21
37. References
■ Scala for Scripting
http://people.apache.org/~mduerig/scala4scripting/
■ Apache Sling
http://sling.apache.org/
■ Michael Dürig
michael.duerig@day.com
■ Day Software AG
http://www.day.com/
22