Slides of a talk I gave at work on Scala. It is geared toward Java developers. Some of the examples are in my company's domain, which is analyzing energy usage (i.e. a "read" is an electric meter read).
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Scala is a multi-paradigm language that runs on the JVM and interoperates with Java code and libraries. It combines object-oriented and functional programming by allowing functions to be treated as objects and supports features like traits, pattern matching, and immutable data structures. The Scala compiler infers types and generates boilerplate code like getters/setters, making development more productive compared to Java. While Scala has a learning curve, it allows a more concise and scalable language for building applications.
This document summarizes some of the key differences between Scala and Java syntax. It covers topics like type definitions, variables, methods, classes, traits, collections, exceptions, control flow, and packages. Overall, the document shows that Scala code is more concise and expressive than equivalent Java code for many common programming constructs.
"The joy of Scala" - Maxim Novak / Wix
Around eight years ago I started my journey as a developer. Since then, I've played around with many languages and thought that C# offers the best developer productivity. After joining Wix two years ago, I was exposed to the amazing world of Scala and Functional Programming and never looked back.
In Scala the code is much more concise, less ceremonious, immutable by default, combines functional with object oriented, seamlessly interoperates with Java, and many software engineering patterns are already baked into the language. Most importantly - Scala is FUN! By the end of the session you too will, hopefully, convert to Scala and never look back.
Recording of the lecture (Hebrew) - https://youtu.be/TcnYTwff2xU
The document introduces Scala and provides an overview of Scala basics including variables, functions, objects, classes, traits, pattern matching, for-comprehensions and more. It also discusses Scala's capabilities for generic programming, lazy evaluation, and integration with Java. Examples are provided throughout to demonstrate Scala concepts.
Scala is becoming the language of choice for many development teams. This talk highlights how Scala excels in the world of multi-core processing and explores how it compares to Java 8.
Video Presentation: http://youtu.be/8vxTowBXJSg
Object Equality In Scala, means comparing two objects by their values and references.Generally, equality is ubiquitous in programming. It is also more tricky than it looks at first glance. This presentation looks at object equality in detail and gives some recommendations to consider when we design our own equality tests.
Short (45 min) version of my 'Pragmatic Real-World Scala' talk. Discussing patterns and idioms discovered during 1.5 years of building a production system for finance; portfolio management and simulation.
Scala is a multi-paradigm language that runs on the JVM and interoperates with Java code and libraries. It combines object-oriented and functional programming by allowing functions to be treated as objects and supports features like traits, pattern matching, and immutable data structures. The Scala compiler infers types and generates boilerplate code like getters/setters, making development more productive compared to Java. While Scala has a learning curve, it allows a more concise and scalable language for building applications.
This document summarizes some of the key differences between Scala and Java syntax. It covers topics like type definitions, variables, methods, classes, traits, collections, exceptions, control flow, and packages. Overall, the document shows that Scala code is more concise and expressive than equivalent Java code for many common programming constructs.
"The joy of Scala" - Maxim Novak / Wix
Around eight years ago I started my journey as a developer. Since then, I've played around with many languages and thought that C# offers the best developer productivity. After joining Wix two years ago, I was exposed to the amazing world of Scala and Functional Programming and never looked back.
In Scala the code is much more concise, less ceremonious, immutable by default, combines functional with object oriented, seamlessly interoperates with Java, and many software engineering patterns are already baked into the language. Most importantly - Scala is FUN! By the end of the session you too will, hopefully, convert to Scala and never look back.
Recording of the lecture (Hebrew) - https://youtu.be/TcnYTwff2xU
The document introduces Scala and provides an overview of Scala basics including variables, functions, objects, classes, traits, pattern matching, for-comprehensions and more. It also discusses Scala's capabilities for generic programming, lazy evaluation, and integration with Java. Examples are provided throughout to demonstrate Scala concepts.
Scala is becoming the language of choice for many development teams. This talk highlights how Scala excels in the world of multi-core processing and explores how it compares to Java 8.
Video Presentation: http://youtu.be/8vxTowBXJSg
Object Equality In Scala, means comparing two objects by their values and references.Generally, equality is ubiquitous in programming. It is also more tricky than it looks at first glance. This presentation looks at object equality in detail and gives some recommendations to consider when we design our own equality tests.
The document discusses Scala programming concepts including object-oriented programming, functional programming, collections, pattern matching, and more. It provides code examples of defining objects and classes, functions, for expressions, match expressions, case classes, traits, generics, and collections like List and Map.
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Java som sprog har ikke bevæget sig meget de seneste år. Vi har stadig ikke closures eller funktionelle aspekter som f.eks. C# har haft siden version 3. Er Scala svaret på enhver Javaudviklers bønner eller er sproget kun interessant for tågehoveder som mig, som begynder at synes bedre og bedre om funktionsorientering? Er den store portion syntaktisk sukker, Scala bringer på bordet, bare tomme kalorier?
I gave this presentation on January 14, 2010 to the Atlanta Scala user group. It covers Scala's implementation of operator overloading, as well as touching on implicit conversions.
This document discusses string handling in Java. Some key points:
- Strings are immutable sequences of characters represented by the String class. StringBuffer allows mutable strings.
- Constructors can initialize strings from arrays of characters or other strings. Methods like length(), charAt(), and compareTo() operate on strings.
- Strings can be concatenated, searched, extracted, modified, and converted between cases. StringBuffer supports mutable operations like insertion and deletion.
Generics and Lambda survival guide - DevNexus 2017Henri Tremblay
This document provides a survival guide for lambdas and generics in Java. It discusses key concepts like covariance, capture, inference, erasure and synthetic methods. It provides examples and explanations of how these concepts work. It also includes tips for avoiding warnings and exceptions when using generics and lambdas. Clean code techniques for refactoring lambda expressions are presented at the end. Useful external references on generics and lambdas are provided.
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...scalaconfjp
The document discusses Scala's ability to combine functional and object-oriented programming paradigms. It provides an example of an Emitter class that uses mutable internal state carried between method invocations to improve performance, while maintaining an immutable/functional API that encapsulates the mutable state so it is not observable from outside the class. This approach allows algorithms with mutable data structures internally for readability while preserving the benefits of immutable/functional programming in the public interface.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document provides an overview of the Scala programming language. Some key points:
- Scala is a statically typed language that runs on the JVM and supports both object-oriented and functional programming.
- Scala code examples demonstrate features like traits, implicit conversions, pattern matching, immutable data structures, and functional-style programming with maps, options, and pattern matching.
- Scala is used to build scalable and concurrent applications with libraries like Akka for actors and STM for software transactional memory. Popular web frameworks built on Scala include Play, Lift and Scalatra.
The Ring programming language version 1.6 book - Part 37 of 189Mahmoud Samir Fayed
This document describes various functions available in the Ring programming language's standard library (stdlib). It provides documentation on functions for string manipulation, mathematical operations, date/time, file handling, and more. Some key classes covered include the String, List, Math, DateTime, and File classes. Examples are provided for many functions to demonstrate their usage and output.
This document provides an overview of Scala and compares it to Java in 3 sentences:
Scala is a multi-paradigm programming language that runs on the Java Virtual Machine and interoperates seamlessly with Java, combining object-oriented and functional programming in one concise, high-level language. Scala improves on Java with features like closures, pattern matching, traits, and immutable data while maintaining a familiar syntax; it compiles to Java bytecode and allows Java and Scala code to interoperate. Scala aims to be a better language for writing concurrent, parallel and distributed applications than Java with its support for actors, futures and software transactional memory.
Monads, also known as Kleisli triples in Category Theory, are an (endo-)functor together with two natural transformations, which are surprisingly useful in pure languages like Haskell, but this talk will NOT reference monads. Ever. (Well, at least not in this talk.)
Instead what I intend to impress upon an audience of newcomers to Haskell is the wide array of freely available libraries most of which are liberally licensed open source software, intuitive package management, practical build tools, reasonable documentation (when you know how to read it and where to find it), interactive shell (or REPL), mature compiler, stable runtime, testing tools that will blow your mind away, and a small but collaborative and knowledgeable community of developers. Oh, and some special features of Haskell - the language - too!
Scala presentation by Aleksandar ProkopecLoïc Descotte
This document provides an introduction to the Scala programming language. It discusses how Scala runs on the Java Virtual Machine, supports both object-oriented and functional programming paradigms, and provides features like pattern matching, immutable data structures, lazy evaluation, and parallel collections. Scala aims to be concise, expressive, and extensible.
Выступление в рамках спецкурса "Немейнстримовые технологии разработки", читаемого в НГУ. http://bit.ly/mainstreamless
Аудио дорожка работает, но нужно иметь некоторое терпение, так как грузится она не моментально.
Scala is an object-oriented and functional programming language that runs on the Java Virtual Machine. It was designed by Martin Odersky and developed at EPFL in Switzerland. Scala combines object-oriented and functional programming principles, including support for immutable data structures, pattern matching, and closures. It interoperates seamlessly with existing Java code and libraries.
This document discusses Scala features for parallelism, concurrency, and reactive programming. Some key points include:
- Scala supports parallel collections that can perform operations like map, reduce, and filter in parallel.
- Futures represent asynchronous computations whose results are not yet known. They allow non-blocking operations.
- Actors are units of concurrency that communicate asynchronously by message passing. They encapsulate state and behavior.
- Akka is a toolkit for building highly concurrent, distributed, and fault-tolerant event-driven applications using actors. It implements the actor model in Scala.
This is brief presentation on the Scala programming language. It is aimed at Java developers who are curious about Scala. It was given at a San Francisco Java User Group in January 2009.
Functional Objects & Function and ClosuresSandip Kumar
Scala functions are objects that implement traits like Function1. Functions are treated as objects with an apply method. When a function is defined as a method in a class, it is treated differently than a standalone function. Functions can take variable arguments using a * notation and have default parameter values specified.
(How) can we benefit from adopting scala?Tomasz Wrobel
Scala offers benefits from adopting it such as increased productivity through concise and expressive code, static typing with type inference, support for both object-oriented and functional programming paradigms, and interoperability with Java. Switching from Java to Scala involves some changes like using val for immutable variables and var for mutable, but overall the syntax is quite similar which eases the transition.
The document discusses Scala programming concepts including object-oriented programming, functional programming, collections, pattern matching, and more. It provides code examples of defining objects and classes, functions, for expressions, match expressions, case classes, traits, generics, and collections like List and Map.
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Scala er et Java-relateret, statisk typet programmeringssprog i hastig fremmarch. Sproget kombinerer aspekter fra objekt- og funktionsorienterede sprog og fokuserer på skalerbarhed og effektivitet, både på det kodemæssige og afviklingsmæssige niveau. Syntaksen er elegant og koncis. Samtidig indeholder sproget stærke konstruktioner til understøttelse af parallelle applikationer, der udnytter fremtidens hardwarearkitekturer.
Java som sprog har ikke bevæget sig meget de seneste år. Vi har stadig ikke closures eller funktionelle aspekter som f.eks. C# har haft siden version 3. Er Scala svaret på enhver Javaudviklers bønner eller er sproget kun interessant for tågehoveder som mig, som begynder at synes bedre og bedre om funktionsorientering? Er den store portion syntaktisk sukker, Scala bringer på bordet, bare tomme kalorier?
I gave this presentation on January 14, 2010 to the Atlanta Scala user group. It covers Scala's implementation of operator overloading, as well as touching on implicit conversions.
This document discusses string handling in Java. Some key points:
- Strings are immutable sequences of characters represented by the String class. StringBuffer allows mutable strings.
- Constructors can initialize strings from arrays of characters or other strings. Methods like length(), charAt(), and compareTo() operate on strings.
- Strings can be concatenated, searched, extracted, modified, and converted between cases. StringBuffer supports mutable operations like insertion and deletion.
Generics and Lambda survival guide - DevNexus 2017Henri Tremblay
This document provides a survival guide for lambdas and generics in Java. It discusses key concepts like covariance, capture, inference, erasure and synthetic methods. It provides examples and explanations of how these concepts work. It also includes tips for avoiding warnings and exceptions when using generics and lambdas. Clean code techniques for refactoring lambda expressions are presented at the end. Useful external references on generics and lambdas are provided.
Functional Object-Oriented Imperative Scala / 関数型オブジェクト指向命令型 Scala by Sébasti...scalaconfjp
The document discusses Scala's ability to combine functional and object-oriented programming paradigms. It provides an example of an Emitter class that uses mutable internal state carried between method invocations to improve performance, while maintaining an immutable/functional API that encapsulates the mutable state so it is not observable from outside the class. This approach allows algorithms with mutable data structures internally for readability while preserving the benefits of immutable/functional programming in the public interface.
I used these slides for a Scala workshop that I gave. They are based on these: http://www.scala-lang.org/node/4454. Thanks to Alf Kristian Støyle and Fredrik Vraalsen for sharing!
This document provides an overview of the Scala programming language. Some key points:
- Scala is a statically typed language that runs on the JVM and supports both object-oriented and functional programming.
- Scala code examples demonstrate features like traits, implicit conversions, pattern matching, immutable data structures, and functional-style programming with maps, options, and pattern matching.
- Scala is used to build scalable and concurrent applications with libraries like Akka for actors and STM for software transactional memory. Popular web frameworks built on Scala include Play, Lift and Scalatra.
The Ring programming language version 1.6 book - Part 37 of 189Mahmoud Samir Fayed
This document describes various functions available in the Ring programming language's standard library (stdlib). It provides documentation on functions for string manipulation, mathematical operations, date/time, file handling, and more. Some key classes covered include the String, List, Math, DateTime, and File classes. Examples are provided for many functions to demonstrate their usage and output.
This document provides an overview of Scala and compares it to Java in 3 sentences:
Scala is a multi-paradigm programming language that runs on the Java Virtual Machine and interoperates seamlessly with Java, combining object-oriented and functional programming in one concise, high-level language. Scala improves on Java with features like closures, pattern matching, traits, and immutable data while maintaining a familiar syntax; it compiles to Java bytecode and allows Java and Scala code to interoperate. Scala aims to be a better language for writing concurrent, parallel and distributed applications than Java with its support for actors, futures and software transactional memory.
Monads, also known as Kleisli triples in Category Theory, are an (endo-)functor together with two natural transformations, which are surprisingly useful in pure languages like Haskell, but this talk will NOT reference monads. Ever. (Well, at least not in this talk.)
Instead what I intend to impress upon an audience of newcomers to Haskell is the wide array of freely available libraries most of which are liberally licensed open source software, intuitive package management, practical build tools, reasonable documentation (when you know how to read it and where to find it), interactive shell (or REPL), mature compiler, stable runtime, testing tools that will blow your mind away, and a small but collaborative and knowledgeable community of developers. Oh, and some special features of Haskell - the language - too!
Scala presentation by Aleksandar ProkopecLoïc Descotte
This document provides an introduction to the Scala programming language. It discusses how Scala runs on the Java Virtual Machine, supports both object-oriented and functional programming paradigms, and provides features like pattern matching, immutable data structures, lazy evaluation, and parallel collections. Scala aims to be concise, expressive, and extensible.
Выступление в рамках спецкурса "Немейнстримовые технологии разработки", читаемого в НГУ. http://bit.ly/mainstreamless
Аудио дорожка работает, но нужно иметь некоторое терпение, так как грузится она не моментально.
Scala is an object-oriented and functional programming language that runs on the Java Virtual Machine. It was designed by Martin Odersky and developed at EPFL in Switzerland. Scala combines object-oriented and functional programming principles, including support for immutable data structures, pattern matching, and closures. It interoperates seamlessly with existing Java code and libraries.
This document discusses Scala features for parallelism, concurrency, and reactive programming. Some key points include:
- Scala supports parallel collections that can perform operations like map, reduce, and filter in parallel.
- Futures represent asynchronous computations whose results are not yet known. They allow non-blocking operations.
- Actors are units of concurrency that communicate asynchronously by message passing. They encapsulate state and behavior.
- Akka is a toolkit for building highly concurrent, distributed, and fault-tolerant event-driven applications using actors. It implements the actor model in Scala.
This is brief presentation on the Scala programming language. It is aimed at Java developers who are curious about Scala. It was given at a San Francisco Java User Group in January 2009.
Functional Objects & Function and ClosuresSandip Kumar
Scala functions are objects that implement traits like Function1. Functions are treated as objects with an apply method. When a function is defined as a method in a class, it is treated differently than a standalone function. Functions can take variable arguments using a * notation and have default parameter values specified.
(How) can we benefit from adopting scala?Tomasz Wrobel
Scala offers benefits from adopting it such as increased productivity through concise and expressive code, static typing with type inference, support for both object-oriented and functional programming paradigms, and interoperability with Java. Switching from Java to Scala involves some changes like using val for immutable variables and var for mutable, but overall the syntax is quite similar which eases the transition.
This document provides an introduction to the Scala programming language. It discusses what Scala is, how to get started, basic concepts like mutability and functions, and Scala features like classes, traits, pattern matching, and collections. Scala combines object-oriented and functional programming. It runs on the Java Virtual Machine and is compatible with Java. The document provides code examples to demonstrate Scala concepts and features.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
The document discusses Scala and functional programming concepts. It provides examples of building a chat application in 30 lines of code using Lift, defining messages as case classes, and implementing a chat server and comet component. It then summarizes that Scala is a pragmatically-oriented, statically typed language that runs on the JVM and provides a unique blend of object-oriented and functional programming. Traits allow for code reuse and multiple class inheritances. Functional programming concepts like immutable data structures, higher-order functions, and for-comprehensions are discussed.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
The document discusses Scala and functional programming concepts. It provides examples of building a chat application in 30 lines of code using Lift, defining case classes and actors for messages. It summarizes that Scala is a pragmatically oriented, statically typed language that runs on the JVM and has a unique blend of object-oriented and functional programming. Functional programming concepts like immutable data structures, functions as first-class values, and for-comprehensions are demonstrated with examples in Scala.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
This document discusses Scala and its features. It provides an example of building a chat application in 30 lines of code using Lift framework. It also demonstrates pattern matching, functional data structures like lists and tuples, for comprehensions, and common Scala tools and frameworks. The document promotes Scala as a pragmatic and scalable language that blends object-oriented and functional programming. It encourages learning more about Scala.
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
The document discusses Scala and functional programming concepts. It provides examples of building a chat application in 30 lines of code using Lift, defining messages as case classes, and implementing a chat server and comet component. It then summarizes that Scala is a pragmatically-oriented, statically typed language that runs on the JVM and provides a unique blend of object-oriented and functional programming. Traits allow for static and dynamic mixin-based composition. Functional programming concepts like immutable data structures, higher-order functions, and for-comprehensions are discussed.
Scala: Object-Oriented Meets Functional, by Iulian Dragos3Pillar Global
A presentation from Iulian Dragos of Typesafe that gives an overview of the Scala programming language. The presentation was given at a Functional Angle conference in Timisoara, Romania sponsored by 3Pillar. Iulian Dragos has been working on Scala since 2004. He currently works for Typesafe, a start-up that was co-founded by Scala’s creator, Martin Odersky.
The document discusses Scala and why some developers think it could replace Java on the JVM. It provides quotes from several influential developers, including the creator of Java and Groovy, expressing their view that Scala is the best candidate to replace Java in the long run. Specifically, James Gosling says that if he had to pick another language on the JVM besides Java, it would be Scala. Charlie Nutter describes Scala as the current heir apparent to the Java throne and the momentum behind Scala is now unquestionable. James Strachan says that if he had seen the Programming in Scala book in 2003, he may have never created Groovy and that his tip for a long term replacement for Java is
Scala is a programming language that runs on the Java Virtual Machine (JVM) and is designed to express common programming patterns in a concise, elegant, and type-safe way. Some key points about Scala include that it is functional and object-oriented, statically typed, and allows seamless integration with Java. Scala code is often more concise than equivalent Java code through features like pattern matching and immutable data structures. Functional programming principles like pure functions, recursion, and avoiding side effects are emphasized in Scala.
This document provides an overview of coding in style with Scala. It discusses embracing expressions over statements, operator notation, using language features to simplify code, favoring higher-order functions, manipulating data with collections, working with asynchronous code and futures, macro programming to transform ASTs, and new features coming in Scala 2.11 like potential modularization and performance improvements. The document encourages idiomatic Scala techniques like favoring expressions, embracing operators, letting the language do work, aiming higher with higher-order functions, and embracing new language features.
The document provides an overview of higher-kinds, typeclasses, type-level encodings, and continuations in Scala. It discusses how kind systems classify types, how typeclasses allow abstraction over types, and examples of encoding data structures like linked lists at the type level. It also introduces delimited continuations in Scala and how they can be used to simulate control flow constructs like break statements.
This document provides a recap of concepts covered on day 1 of a Scala training, including:
- How variables, methods, classes, tuples, and the Option type work differently in Scala compared to Java.
- Key Scala features like first class functions, closures, pattern matching, and traits.
- An overview of the schedule for day 1 which includes higher order functions, implicit conversions, XML support, and building a quiz game task.
Java Cheat Sheet includes the following contents:
- Data Types
- Statements
- String, ArrayList and HashMap Methods
- Conversion
- Operators
- Exception Handling
This document discusses lambda functions and new features coming to Java 8, including lambda functions (anonymous functions), method references, default methods in interfaces, and functional interfaces with a single abstract method. It provides examples of lambda functions and explores how they can be used for filtering, mapping, chaining, and iterating over collections.
From Java to Scala - advantages and possible risksSeniorDevOnly
Oleksii Petinov during his presentation gave the audience the overview of his vision of Scala pros and contras. In his vision Scala smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive.
There is admittedly some truth to the statement that “Scala is complex”, but the learning curve is well worth the investment.
TI1220 Lecture 8: Traits & Type ParameterizationEelco Visser
Traits allow code reuse through mixing in. Traits can contain fields, methods, and act as types. When mixed into classes, traits are linearly ordered and calls to super are dispatched accordingly. This avoids problems with multiple inheritance by ensuring there is always a single linearization of supertypes. The example code defines classes and traits for animals with traits for properties like being furry or having legs. It demonstrates how trait mixing and method overriding works.
Scala is an object-oriented and functional programming language that runs on the Java Virtual Machine. It was created in 2001 by Martin Odersky and aims to integrate features of object-oriented and functional languages. Scala code is compiled to JVM bytecode and supports interoperability with Java libraries and frameworks. Some key features of Scala include support for immutable data structures, pattern matching, traits for mixing composition, and functional programming constructs like functions as first-class values. Scala has gained popularity in industry at companies like LinkedIn, Twitter, and The Guardian.
ZIO-Direct allows direct style programming with ZIO. This library provides a *syntactic sugar* that is more powerful than for-comprehensions as well as more natural to use. Simply add the `.run` suffix to any ZIO effect in order to retrieve it's value.
Essentials of Automations: Exploring Attributes & Automation ParametersSafe Software
Building automations in FME Flow can save time, money, and help businesses scale by eliminating data silos and providing data to stakeholders in real-time. One essential component to orchestrating complex automations is the use of attributes & automation parameters (both formerly known as “keys”). In fact, it’s unlikely you’ll ever build an Automation without using these components, but what exactly are they?
Attributes & automation parameters enable the automation author to pass data values from one automation component to the next. During this webinar, our FME Flow Specialists will cover leveraging the three types of these output attributes & parameters in FME Flow: Event, Custom, and Automation. As a bonus, they’ll also be making use of the Split-Merge Block functionality.
You’ll leave this webinar with a better understanding of how to maximize the potential of automations by making use of attributes & automation parameters, with the ultimate goal of setting your enterprise integration workflows up on autopilot.
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfChart Kalyan
A Mix Chart displays historical data of numbers in a graphical or tabular form. The Kalyan Rajdhani Mix Chart specifically shows the results of a sequence of numbers over different periods.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsDianaGray10
Join us to learn how UiPath Apps can directly and easily interact with prebuilt connectors via Integration Service--including Salesforce, ServiceNow, Open GenAI, and more.
The best part is you can achieve this without building a custom workflow! Say goodbye to the hassle of using separate automations to call APIs. By seamlessly integrating within App Studio, you can now easily streamline your workflow, while gaining direct access to our Connector Catalog of popular applications.
We’ll discuss and demo the benefits of UiPath Apps and connectors including:
Creating a compelling user experience for any software, without the limitations of APIs.
Accelerating the app creation process, saving time and effort
Enjoying high-performance CRUD (create, read, update, delete) operations, for
seamless data management.
Speakers:
Russell Alfeche, Technology Leader, RPA at qBotic and UiPath MVP
Charlie Greenberg, host
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
Main news related to the CCS TSI 2023 (2023/1695)Jakub Marek
An English 🇬🇧 translation of a presentation to the speech I gave about the main changes brought by CCS TSI 2023 at the biggest Czech conference on Communications and signalling systems on Railways, which was held in Clarion Hotel Olomouc from 7th to 9th November 2023 (konferenceszt.cz). Attended by around 500 participants and 200 on-line followers.
The original Czech 🇨🇿 version of the presentation can be found here: https://www.slideshare.net/slideshow/hlavni-novinky-souvisejici-s-ccs-tsi-2023-2023-1695/269688092 .
The videorecording (in Czech) from the presentation is available here: https://youtu.be/WzjJWm4IyPk?si=SImb06tuXGb30BEH .
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Dandelion Hashtable: beyond billion requests per second on a commodity serverAntonios Katsarakis
This slide deck presents DLHT, a concurrent in-memory hashtable. Despite efforts to optimize hashtables, that go as far as sacrificing core functionality, state-of-the-art designs still incur multiple memory accesses per request and block request processing in three cases. First, most hashtables block while waiting for data to be retrieved from memory. Second, open-addressing designs, which represent the current state-of-the-art, either cannot free index slots on deletes or must block all requests to do so. Third, index resizes block every request until all objects are copied to the new index. Defying folklore wisdom, DLHT forgoes open-addressing and adopts a fully-featured and memory-aware closed-addressing design based on bounded cache-line-chaining. This design offers lock-free index operations and deletes that free slots instantly, (2) completes most requests with a single memory access, (3) utilizes software prefetching to hide memory latencies, and (4) employs a novel non-blocking and parallel resizing. In a commodity server and a memory-resident workload, DLHT surpasses 1.6B requests per second and provides 3.5x (12x) the throughput of the state-of-the-art closed-addressing (open-addressing) resizable hashtable on Gets (Deletes).
Conversational agents, or chatbots, are increasingly used to access all sorts of services using natural language. While open-domain chatbots - like ChatGPT - can converse on any topic, task-oriented chatbots - the focus of this paper - are designed for specific tasks, like booking a flight, obtaining customer support, or setting an appointment. Like any other software, task-oriented chatbots need to be properly tested, usually by defining and executing test scenarios (i.e., sequences of user-chatbot interactions). However, there is currently a lack of methods to quantify the completeness and strength of such test scenarios, which can lead to low-quality tests, and hence to buggy chatbots.
To fill this gap, we propose adapting mutation testing (MuT) for task-oriented chatbots. To this end, we introduce a set of mutation operators that emulate faults in chatbot designs, an architecture that enables MuT on chatbots built using heterogeneous technologies, and a practical realisation as an Eclipse plugin. Moreover, we evaluate the applicability, effectiveness and efficiency of our approach on open-source chatbots, with promising results.
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyScyllaDB
Freshworks creates AI-boosted business software that helps employees work more efficiently and effectively. Managing data across multiple RDBMS and NoSQL databases was already a challenge at their current scale. To prepare for 10X growth, they knew it was time to rethink their database strategy. Learn how they architected a solution that would simplify scaling while keeping costs under control.
What is an RPA CoE? Session 1 – CoE VisionDianaGray10
In the first session, we will review the organization's vision and how this has an impact on the COE Structure.
Topics covered:
• The role of a steering committee
• How do the organization’s priorities determine CoE Structure?
Speaker:
Chris Bolin, Senior Intelligent Automation Architect Anika Systems
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframePrecisely
Inconsistent user experience and siloed data, high costs, and changing customer expectations – Citizens Bank was experiencing these challenges while it was attempting to deliver a superior digital banking experience for its clients. Its core banking applications run on the mainframe and Citizens was using legacy utilities to get the critical mainframe data to feed customer-facing channels, like call centers, web, and mobile. Ultimately, this led to higher operating costs (MIPS), delayed response times, and longer time to market.
Ever-changing customer expectations demand more modern digital experiences, and the bank needed to find a solution that could provide real-time data to its customer channels with low latency and operating costs. Join this session to learn how Citizens is leveraging Precisely to replicate mainframe data to its customer channels and deliver on their “modern digital bank” experiences.
Taking AI to the Next Level in Manufacturing.pdfssuserfac0301
Read Taking AI to the Next Level in Manufacturing to gain insights on AI adoption in the manufacturing industry, such as:
1. How quickly AI is being implemented in manufacturing.
2. Which barriers stand in the way of AI adoption.
3. How data quality and governance form the backbone of AI.
4. Organizational processes and structures that may inhibit effective AI adoption.
6. Ideas and approaches to help build your organization's AI strategy.
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
19. List<String> oyVey = new ArrayList<String>();
var hellsYeah = new ArrayList[String];
19
20. List<String> oyVey = new ArrayList<String>();
var hellsYeah = new ArrayList[String];
val booyah = 45; // it’s an Int
20
21. List<String> oyVey = new ArrayList<String>();
var hellsYeah = new ArrayList[String];
val booyah = 45; // it’s an Int
val doh = booyah / 3; // not a Float!!
21
22. List<String> oyVey = new ArrayList<String>();
var hellsYeah = new ArrayList[String];
val booyah = 45; // it’s an Int
val doh = booyah / 3; // not a Float!!
val better:Float = booyah / 3;
22
23. List<String> oyVey = new ArrayList<String>();
var hellsYeah = new ArrayList[String];
val booyah = 45; // it’s an Int
val doh = booyah / 3; // not a Float!!
val better:Float = booyah / 3;
// return type is java.lang.String
def fullName = { first + “,” + last; }
23
24. List<String> oyVey = new ArrayList<String>();
var hellsYeah = new ArrayList[String];
val booyah = 45; // it’s an Int
val doh = booyah / 3; // not a Float!!
val better:Float = booyah / 3;
// return type is java.lang.String
def fullName = { first + “,” + last; }
If the type seems obvious to you...
24
25. List<String> oyVey = new ArrayList<String>();
var hellsYeah = new ArrayList[String];
val booyah = 45; // it’s an Int
val doh = booyah / 3; // not a Float!!
val better:Float = booyah / 3;
// return type is java.lang.String
def fullName = { first + “,” + last; }
If the type seems obvious to you...
Scala can usually figure it out, too
25
27. val semicolons = “don’t need ‘em”
val but = “if it’s not clear”; val you = “need them”
27
28. val semicolons = “don’t need ‘em”
val but = “if it’s not clear”; val you = “need them”
def braces(b:Boolean) =
if (b)
“needed for multiple expressions”
else
“you don’t need them”
28
29. val semicolons = “don’t need ‘em”
val but = “if it’s not clear”; val you = “need them”
def braces(b:Boolean) =
if (b)
“needed for multiple expressions”
else
“you don’t need them”
• if/else is a singular expression
29
30. class Read(d:Date, val usage:Int) {
def +(other:Int) = new Read(d,usage + other)
override def toString = d + “:” + u
}
30
31. class Read(d:Date, val usage:Int) {
def +(other:Int) = new Read(d,usage + other)
override def toString = d + “:” + u
}
val f = new Read(new Date,10)
val g = f + 20
31
32. class Read(d:Date, val usage:Int) {
def +(other:Int) = new Read(d,usage + other)
override def toString = d + “:” + u
}
val f = new Read(new Date,10)
val g = f + 20
val gee = f.+(20) // yuck, but legal
32
33. class Read(d:Date, val usage:Int) {
def +(other:Int) = new Read(d,usage + other)
override def toString = d + “:” + u
def later(ms:Int) = new Read(d + ms,usage)
}
val f = new Read(new Date,10)
val g = f + 20
val gee = f.+(20) // yuck, but legal
val l = f later (3600 * 1000)
33
35. abstract class SaneCompare[T] {
def <(other:T):Boolean
def >(other:T) = !(this < other)
def <=(other:T) = this == other || this < other
def >=(other:T) = this == other || this > other
}
class Read(d:Date,u:Int) extends SaneCompare[Read] {
val usage = u
def <(other:Read) = usage < other.usage
}
if (someRead >= someOtherRead) println(”finally!”)
35
36. abstract class SaneCompare[T] {
def <(other:T):Boolean
def >(other:T) = !(this < other)
def <=(other:T) = this == other || this < other
def >=(other:T) = this == other || this > other
}
class Read(d:Date,u:Int) extends AbstractEntity {
val usage = u
def <(other:Read) = usage < other.usage
}
// hmmm....what now?
36
37. abstract class SaneCompare[T] {
def <(other:T):Boolean
def >(other:T) = !(this < other)
def <=(other:T) = this == other || this < other
def >=(other:T) = this == other || this > other
}
class Read(d:Date,u:Int) extends AbstractEntity {
val usage = u
def <(other:Read) = usage < other.usage
}
// AbstractEntity extends SaneCompare?
// God class above AbstractEntity subsumes it?
37
38. abstract class SaneCompare[T] {
def <(other:T):Boolean
def >(other:T) = !(this < other)
def <=(other:T) = this == other || this < other
def >=(other:T) = this == other || this > other
}
class Read(d:Date,u:Int) extends AbstractEntity {
val usage = u
def <(other:Read) = usage < other.usage
}
// AbstractEntity extends SaneCompare?
// God class above AbstractEntity subsumes it?
// these are different concepts entirely
38
39. trait SaneCompare[T] {
def <(other:T):Boolean
def >(other:T) = !(this < other)
def <=(other:T) = this == other || this < other
def >=(other:T) = this == other || this > other
}
class Read(d:Date,u:Int) extends AbstractEntity
with SaneCompare[Read] {
val usage = u
def <(other:Read) = usage < other.usage
}
// now we have both!
39
42. Traits
•Separate Concerns
• Precedence is based on declaration order
• All abstract – just like Java interface
• None abstract – multiple inheritance
42
52. class State(val code:String,val desc:String)
val states = getAllStates
// returns a List[String] with the codes
states.map( (state) => state.code )
// returns true if any state has a code of “DC”
states.exists( (state) => state.code == “DC” )
// returns the state with the desc of “Hawaii”
states.find( (state) => state.desc == “Hawaii” )
// returns a List[State] if states with descs matching
states.filter( (state) => state.desc.startsWith(”V”) )
// Tons more
52
61. Proper F’ing Properties
class ServicePoint(val id:String,var name:String)
val sp = new ServicePoint(”foo”,”The Foo House”)
println(sp.id) // get, but no set
println(sp.name)
sp.name = “Thy Foo Haüs”
61
62. Proper F’ing Properties
class ServicePoint(val id:String,private var _name:String) {
def name = _name.toUpperCase
def name_=(newName:String) = _name = newName
}
val sp = new ServicePoint(”foo”,”The Foo House”)
sp.name = “Thy Foo Haüs”
println(sp.name) // prints THY FOO HAÜS
62
63. ¡Adiós Checked Exceptions!
def readFile(f:File) = {
val is = new FileInputStream(f)
var ch = f.read
while (ch != -1) {
print(ch)
ch = f.read
}
} // Wow, that was clean!
63
64. ¡Adiós Checked Exceptions!
def readFile(f:File) = {
try {
val is = new FileInputStream(f)
var ch = f.read()
while (ch != -1) {
print(ch)
ch = f.read
}
} catch {
case fnfe:FileNotFoundException =>
println(f + ” not found, dude: ” + fnfe)
} // All others bubble out, even if checked in Java
}
64
65. Can I get a closure?
class Logger(level:Int) {
def debug(message: => String) = log(20,message)
def info(message: => String) = log(10,message)
def log(logLevel:Int, message: => String) = {
if (level >= logLevel) println(message)
}
}
val log = new Logger(10)
log.debug(“Got read for “ + read.date +
“ with usage “ + read.usage)
read.usage = 44
log.info(if read.usage < 10 “low read”
else “high read”)
65
66. Can I get a closure?
class Logger(level:Int) {
def debug(message: => String) = log(20,message)
def info(message: => String) = log(10,message)
def log(logLevel:Int, message: => String) = {
if (level >= logLevel) println(message)
}
}
val log = new Logger(10)
log.debug(“Got read for “ + read.date +
“ with usage “ + read.usage)
read.usage = 44
log.info(if read.usage < 10 “low read”
else “high read”)
66
67. Can I get a closure?
class Logger(level:Int) {
def debug(message: => String) = log(20,message)
def info(message: => String) = log(10,message)
def log(logLevel:Int, message: => String) = {
if (level >= logLevel) println(message)
}
}
val log = new Logger(10)
log.debug(“Got read for “ + read.date +
“ with usage “ + read.usage)
read.usage = 44
log.info(if read.usage < 10 “low read”
else “high read”)
67
68. Can I get a closure?
class Logger(level:Int) {
def debug(message: => String) = log(20,message)
def info(message: => String) = log(10,message)
def log(logLevel:Int, message: => String) = {
if (level >= logLevel) println(message)
}
}
val log = new Logger(10)
log.debug(“Got read for “ + read.date +
“ with usage “ + read.usage)
read.usage = 44
log.info(if read.usage < 10 “low read”
else “high read”)
68
69. Can I get a closure?
class Logger(level:Int) {
def debug(message: => String) = log(20,message)
def info(message: => String) = log(10,message)
def log(logLevel:Int, message: => String) = {
if (level >= logLevel) println(message)
}
}
val log = new Logger(10)
log.debug(“Got read for “ + read.date +
“ with usage “ + read.usage)
read.usage = 44
log.info(if read.usage < 10 “low read”
else “high read”)
69
70. “Literals”
val triStateArea = List(”MD”,”DC”,”VA”)
val theSouth = Map(”MD” -> true,”DC” -> false,
”VA” ->true)
val perlCirca96 = (true,”Tuples rule”)
val (hasTuples,message) = perlCirca96
70
71. “Literals”
val triStateArea = List(”MD”,”DC”,”VA”)
val theSouth = Map(”MD” -> true,”DC” -> false,
”VA” ->true)
val perlCirca96 = (true,”Tuples rule”)
val (hasTuples,message) = perlCirca96
These are actually API calls
71
72. “Literals”
val triStateArea = List(”MD”,”DC”,”VA”)
val theSouth = Map(”MD” -> true,”DC” -> false,
”VA” ->true)
val perlCirca96 = (true,”Tuples rule”)
val (hasTuples,message) = perlCirca96
This is done by the compiler
creates a Tuple2[Boolean, String]
72
73. “Literals”
class Read(val id:Int, val usage:Int, val age:Int)
object Read {
def apply(id:Int,usage:Int,age:Int) =
new Read(id,usage,age)
}
val read = Read(4,10,33)
73
74. “Literals”
class Read(val id:Int, val usage:Int, val age:Int)
object Read {
def apply(id:Int,usage:Int,age:Int) =
new Read(id,usage,age)
}
val read = Read(4,10,33) // shortcut via compiler
val read2 = Read.apply(4,10,33)
74
75. Crazy Awesome - Pattern Matching
def fromEnglish(string:String) = string match {
case “none” => 0
case “one” => 1
case _ => 2
}
75
76. Crazy Awesome - Pattern Matching
def toUML(obj:Any) = obj match {
case 0 => “0”
case 1 => “0..1”
case n:Int => “0..” + n
case true => “1”
case false => “0”
case “many” => “0..*”
case _ => “0..*”
}
76
77. Crazy Awesome - Pattern Matching
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
def proRate(read:Read) = read match {
case AMIRead(d,usage,duration) => usage / duration
case BillingRead(d,usage,days,c) => usage / days
case CorrectedRead(BillingRead(d,oldUsage,days,c),usage) =>
(oldUsage + usage) / days
}
77
78. Crazy Awesome - Pattern Matching
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
def proRate(read:Read) = read match {
case AMIRead(d,usage,duration) => usage / duration
case BillingRead(d,usage,days,c) => usage / days
case CorrectedRead(BillingRead(d,oldUsage,days,c),usage) =>
(oldUsage + usage) / days
}
• properties
• equals/toString/hashCode
• “extractor”
• no need for “new”
78
79. Crazy Awesome - Pattern Matching
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
def proRate(read:Read) = read match {
case AMIRead(d,usage,duration) => usage / duration
case BillingRead(d,usage,days,c) => usage / days
case CorrectedRead(BillingRead(d,oldUsage,days,c),usage) =>
(oldUsage + usage) / days
}
79
80. Crazy Awesome - Pattern Matching
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
def proRate(read:Read) = read match {
case AMIRead(d,usage,duration) => usage / duration
case BillingRead(d,usage,days,c) => usage / days
case CorrectedRead(BillingRead(d,oldUsage,days,c),usage) =>
(oldUsage + usage) / days
}
80
81. Crazy Awesome - Pattern Matching
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
def proRate(read:Read) = read match {
case AMIRead(d,usage,duration) => usage / duration
case BillingRead(d,usage,days,c) => usage / days
case CorrectedRead(BillingRead(d,oldUsage,days,c),usage) =>
(oldUsage + usage) / days
}
81
82. Crazy Awesome - Pattern Matching
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
def proRate(read:Read) = read match {
case AMIRead(d,usage,duration) => usage / duration
case BillingRead(d,usage,days,c) => usage / days
case CorrectedRead(BillingRead(d,oldUsage,days,c),usage) =>
(oldUsage + usage) / days
}
82
83. Crazy Awesome - Implicits
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
implicit def readToSeconds(r:Read):Int = r.date.getTime / 1000
def areConsecutive(from:Read, to:Read) =
(from - to) <= from.duration
83
84. Crazy Awesome - Implicits
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
implicit def readToSeconds(r:Read):Int = r.date.getTime / 1000
def areConsecutive(from:Read, to:Read) =
(from - to) <= from.duration
Have a Read, but need an Int
84
85. Crazy Awesome - Implicits
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
implicit def readToSeconds(r:Read):Int = r.date.getTime / 1000
def areConsecutive(from:Read, to:Read) =
(from - to) > from.duration
Needs a Read and gives an Int
85
86. Crazy Awesome - Implicits
sealed abstract class Read
case class AMIRead(date:Date,usage:Int,duration:Int) extends Read
case class BillingRead(toDate:Date,usage:Int,numDays:Int,charges:Int) extends Read
case class CorrectedRead(read:BillingRead, usage:Int) extends Read
implicit def readToSeconds(r:Read):Int = r.date.getTime / 1000
def areConsecutive(from:Read, to:Read) =
(from - to) > from.duration
• Given this and matching, casting is rarely needed
86
87. Crazy Awesome - XML Literals
val xml = <html>
<head>
<title>Scala Pronunciation Guide</title>
</head>
<body>
<h1>How to Pronounce It</h1>
</body>
</html>
println(xml)
87
88. Crazy Awesome - XML Literals
val lang = getLang
val title = translate(”scala.title”,lang)
val xml = <html lang={lang}>
<head>
<title>{title}</title>
</head>
<body>
<h1>{title.toUpperCase}</h1>
</body>
</html>
println(xml)
88
89. Crazy Awesome - XML Literals
val lang = getLang
val title = translate(”scala.title”,lang)
val xml = <html lang={lang}>
<head>
<title>{title}</title>
</head>
<body>
<h1>{title.toUpperCase}</h1>
</body>
</html>
println(xml)
89
90. Crazy Awesome - XML Literals
val states = List(”DC”,”MD”,”VA”)
val xml = <html>
<body>
<h1>States</h1>
<ul>
{ states.map( (state) => <li>{state}</li> ) }
</ul>
</body>
</html>
println(xml)
90
94. Message Passing
Immutable objects
“actors” with “mailboxes”
94
95. case class Accumulate(amount: Int)
case class Reset
case class Total
object Accumulator extends Actor {
def act = {
var sum = 0
loop {
react {
case Accumulate(n) => sum += n
case Reset => sum = 0
case Total => reply(sum); exit
}
}
}
}
object Accumulators extends Application {
Accumulator.start
for(i <- (1 to 100)) {
Accumulator ! Accumulate(i)
}
Accumulator !? Total match {
case result: Int => println(result)
}
}
95
96. case class Accumulate(amount: Int)
case class Reset
case class Total
object Accumulator extends Actor {
def act = {
var sum = 0
loop {
react {
case Accumulate(n) => sum += n
case Reset => sum = 0
case Total => reply(sum); exit
}
}
}
}
object Accumulators extends Application {
Accumulator.start
for(i <- (1 to 100)) {
Accumulator ! Accumulate(i)
}
Accumulator !? Total match {
case result: Int => println(result)
}
}
96
97. case class Accumulate(amount: Int)
case class Reset
case class Total
object Accumulator extends Actor {
def act = {
var sum = 0
loop {
react {
case Accumulate(n) => sum += n
case Reset => sum = 0
case Total => reply(sum); exit
}
}
}
}
object Accumulators extends Application {
Accumulator.start
for(i <- (1 to 100)) {
Accumulator ! Accumulate(i)
}
Accumulator !? Total match {
case result: Int => println(result)
}
}
97
98. case class Accumulate(amount: Int)
case class Reset
case class Total
object Accumulator extends Actor {
def act = {
var sum = 0
loop {
react {
case Accumulate(n) => sum += n
case Reset => sum = 0
case Total => reply(sum); exit
}
}
}
}
object Accumulators extends Application {
Accumulator.start
for(i <- (1 to 100)) {
Accumulator ! Accumulate(i)
}
Accumulator !? Total match {
case result: Int => println(result)
}
}
98
99. case class Accumulate(amount: Int)
case class Reset
case class Total
object Accumulator extends Actor {
def act = {
var sum = 0
loop {
react {
case Accumulate(n) => sum += n
case Reset => sum = 0
case Total => reply(sum); exit
}
}
}
}
object Accumulators extends Application {
Accumulator.start
for(i <- (1 to 100)) {
Accumulator ! Accumulate(i)
}
Accumulator !? Total match {
case result: Int => println(result)
}
}
99
100. case class Accumulate(amount: Int)
case class Reset
case class Total
object Accumulator extends Actor {
def act = {
var sum = 0
loop {
react {
case Accumulate(n) => sum += n
case Reset => sum = 0
case Total => reply(sum); exit
}
}
}
}
object Accumulators extends Application {
Accumulator.start
for(i <- (1 to 100)) {
Accumulator ! Accumulate(i)
}
Accumulator !? Total match {
case result: Int => println(result)
}
}
100
101. case class Accumulate(amount: Int)
case class Reset
case class Total
object Accumulator extends Actor {
def act = {
var sum = 0
loop {
react {
case Accumulate(n) => sum += n
case Reset => sum = 0
case Total => reply(sum); exit
}
}
}
}
object Accumulators extends Application {
Accumulator.start
for(i <- (1 to 100)) {
Accumulator ! Accumulate(i)
}
Accumulator !? Total match {
case result: Int => println(result)
}
}
101
107. for all consecutive reads r1 and r2
if r2 - r1 > one day
fill gaps for (r1,r2)
107
108. fill:
for all reads (first,second,List(rest))
if gap(first,second)
fill_gap(first,second) + fill(second + rest)
else
first + fill(second + rest)
108
109. fill:
for all reads (first,second,List(rest))
if !first || !second
reads
else if gap(first,second)
fill_gap(first,second) + fill(second + rest)
else
first + fill(second + rest)
109
110. def fillReads(
strategy: (MeterRead,MeterRead) => Seq[MeterRead],
reads:List[MeterRead]):List[MeterRead] =
reads match {
case List() => List()
case first :: List() => List(first)
case first :: second :: rest if gap(first, second) =>
first :: strategy(x,y).toList ::: fillReads(strategy, second :: rest)
case first :: rest => first :: fillReads(strategy,rest)
}
110
111. def fillReads(
strategy: (MeterRead,MeterRead) => Seq[MeterRead],
reads:List[MeterRead]):List[MeterRead] =
reads match {
case List() => List()
case first :: List() => List(first)
case first :: second :: rest if gap(first, second) =>
first :: strategy(x,y).toList ::: fillReads(strategy, second :: rest)
case first :: rest => first :: fillReads(strategy,rest)
}
111
112. def fillReads(
strategy: (MeterRead,MeterRead) => Seq[MeterRead],
reads:List[MeterRead]):List[MeterRead] =
reads match {
case List() => List()
case first :: List() => List(first)
case first :: second :: rest if gap(first, second) =>
first :: strategy(x,y).toList ::: fillReads(strategy, second :: rest)
case first :: rest => first :: fillReads(strategy,rest)
}
112