Beyond xUnit example-based testing: property-based testing with ScalaCheckFranklin Chen
Test-Driven Development has become deservedly popular in the past decade, with easy-to-use xUnit unit testing frameworks leading the way toward encouraging developers to write tests. But xUnit has limitations: how does one know one has written enough test cases for a desired behavior? And what if the behavior is conditional on other behavior? Property-based testing, first popularized for Haskell with the QuickCheck library, but available now for other languages as well, offers a powerful addition to one's testing toolkit.
I will discuss the concepts of property-based testing and illustrate them concretely using ScalaCheck for Scala, and point toward similar test frameworks in other languages.
Akka is a toolkit for building highly concurrent, distributed, and fault-tolerant applications on the JVM. It provides actors as the fundamental unit of concurrency. Actors receive messages asynchronously and process them one at a time by applying behaviors. Akka uses a supervision hierarchy where actors monitor child actors and handle failures through configurable strategies like restart or stop. This provides clean separation of processing and error handling compared to traditional approaches.
Martin Odersky received his PhD in 1989 and began designing Scala in 2001 at EPFL. Scala is a functional and object-oriented programming language that runs on the Java Virtual Machine. It is concise, high-level, statically typed, and supports both immutable and mutable data structures. Many large companies use Scala including LinkedIn, Twitter, and Ebay. Scala supports both object-oriented programming with classes, traits, and objects as well as functional programming with immutable data, higher-order functions, and algebraic data types.
In this presentation, You will get to know about Function Literal,Higher Order Function,Partial Function,Partial Applied Function,Nested Function,Closures.
This document provides an introduction to the Scala programming language for Java programmers. It discusses Scala's motivation as a scalable and more productive alternative to Java. Key features covered include static typing, object-oriented and functional programming, traits, pattern matching, and actors. Examples are provided to illustrate concepts like functions as first-class values, partially applied functions, and collection operations. The document concludes by mentioning additional Scala concepts and providing references for further reading.
Beyond xUnit example-based testing: property-based testing with ScalaCheckFranklin Chen
Test-Driven Development has become deservedly popular in the past decade, with easy-to-use xUnit unit testing frameworks leading the way toward encouraging developers to write tests. But xUnit has limitations: how does one know one has written enough test cases for a desired behavior? And what if the behavior is conditional on other behavior? Property-based testing, first popularized for Haskell with the QuickCheck library, but available now for other languages as well, offers a powerful addition to one's testing toolkit.
I will discuss the concepts of property-based testing and illustrate them concretely using ScalaCheck for Scala, and point toward similar test frameworks in other languages.
Akka is a toolkit for building highly concurrent, distributed, and fault-tolerant applications on the JVM. It provides actors as the fundamental unit of concurrency. Actors receive messages asynchronously and process them one at a time by applying behaviors. Akka uses a supervision hierarchy where actors monitor child actors and handle failures through configurable strategies like restart or stop. This provides clean separation of processing and error handling compared to traditional approaches.
Martin Odersky received his PhD in 1989 and began designing Scala in 2001 at EPFL. Scala is a functional and object-oriented programming language that runs on the Java Virtual Machine. It is concise, high-level, statically typed, and supports both immutable and mutable data structures. Many large companies use Scala including LinkedIn, Twitter, and Ebay. Scala supports both object-oriented programming with classes, traits, and objects as well as functional programming with immutable data, higher-order functions, and algebraic data types.
In this presentation, You will get to know about Function Literal,Higher Order Function,Partial Function,Partial Applied Function,Nested Function,Closures.
This document provides an introduction to the Scala programming language for Java programmers. It discusses Scala's motivation as a scalable and more productive alternative to Java. Key features covered include static typing, object-oriented and functional programming, traits, pattern matching, and actors. Examples are provided to illustrate concepts like functions as first-class values, partially applied functions, and collection operations. The document concludes by mentioning additional Scala concepts and providing references for further reading.
This document discusses operators in Java, including assignment, arithmetic, relational, and logical operators. It provides examples of using various operators and discusses some key points about operator precedence and equality testing. Specifically, it covers compound assignment operators, relational operators for comparison, and how equality is determined for primitives and object references. It also notes some topics about operators that are no longer covered on the Java certification exam.
This document discusses generics in Java and the benefits they provide. It explains that before generics, collections like ArrayList could hold multiple different types of objects, risking ClassCastExceptions. With generics, the type is specified within angle brackets, allowing the compiler to catch type errors and ensuring a collection only holds the specified type. An example shows how a non-generic list can hold integers and strings, while a generic list specified to hold integers no longer allows strings. Generics eliminate casting and type safety issues.
Some notes about programming in Scala: it covers Scala syntax and semantics, programming techniques, idioms, patterns. Many Scala features are introduced, from basic to intermediate and advanced. These are not introductory notes, but they assume a working knowledge with some other programming language (Java, C#, C++), object-oriented programming (OOP) concepts, and functional programming (FP) concepts.
Scala case classes provide a convenient way to pattern match on class types. Case classes automatically generate useful methods like equals, hashCode, and toString. When defining a case class, the constructor parameters become val fields of the class. This allows simple access and comparison of case class values. Case classes also avoid the need for the 'new' keyword when constructing new instances.
My talk at Bangalore Java Users Group. It was meant developers who want to get them started on Scala. This talk objectives was to get started on creating a project in Scala, write some code using collections and test it using ScalaTest.
This document provides a taxonomy of Scala concepts including object-oriented features, pattern matching, functional programming, actors, futures, implicits, type theory, macros, and category theory. It aims to serve as a reference for many of the terms used in the Scala community. The document covers topics such as case classes, lazy definitions, imports, objects, tuples, pattern matching examples, immutable collections, higher order functions, parallel collections, partial functions, currying, actors, futures, implicit conversions, implicit parameters, implicit classes, type inference, type classes, higher kinded types, algebraic data types, macros, concepts and arrows in category theory, morphisms, and functors.
Guava is Java libraries by Google.
This is Introduction of Guava with some API and sample codes.
Its samples are here.
http://www.slideshare.net/akirakoyasu/hello-guava-samples
The document discusses functional programming concepts in Scala including creating immutable objects to represent rational numbers, using pattern matching to add rationals, and defining classes with private fields and auxiliary constructors while avoiding side effects through immutable and functional design. It provides examples of functional programming techniques like creating rational number objects that are immutable and can be freely passed around without risk of mutation, and defining methods as functions that take arguments instead of mutating object state.
This document provides a summary of key concepts in Ruby including:
- Everything is an object in Ruby including true, false, nil
- Classes are defined using class, modules using module, and objects are created using Object.new
- Methods are defined using def, variables can have default values, and returns are not required
- Modules contain reusable code that can be included in classes
- Classes can inherit from other classes and modules can be mixed in
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.
This document provides an overview of functional programming concepts in Scala including:
- Scala supports both object-oriented and functional programming paradigms.
- Functional programming avoids side effects and uses immutable data and pure functions.
- Scala supports first-class functions, higher-order functions, and functional data structures like Options and Try.
- Functional patterns like mapping, filtering, and pattern matching help express programs concisely in a referentially transparent style.
Property based Testing - generative data & executable domain rulesDebasish Ghosh
- Property based testing verifies properties and invariants of code through automated generation of random test data rather than testing with specific hard-coded test cases. This helps uncover subtle bugs and edge cases.
- Key aspects include defining properties to specify constraints that must hold, using a library like ScalaCheck to generate random data and verify properties hold, and defining custom generators for domain-specific types.
- Properties can verify things like business rules of a domain model in a more abstract way compared to traditional unit tests.
Scala is a programming language that unifies object-oriented and functional programming. The document introduces Scala concepts including everything being an expression, pattern matching, and the type system. It discusses Scala's class hierarchy and data types. It also covers programming with Scala using the REPL, worksheets, and main and App objects. Finally, it provides an overview of object-oriented concepts in Scala like classes, traits, and case classes as well as functional concepts like anonymous functions, higher-order functions, and immutability.
Scala collections provide a uniform approach to working with data structures. They are generic, immutable, and support higher-order functions like map and filter. The core abstractions are Traversable and Iterable, with subclasses including lists, sets, and maps. Collections aim to be object-oriented, persistent, and follow principles like the uniform return type. They allow fluent, expressive ways to transform, query, and manipulate data in a functional style.
The document summarizes key points from a lecture on Scala programming:
1. Implicits allow defining implicit conversions to resolve type mismatches and fix compiler errors. Monads separate composition timeline from execution and allow computations to carry extra data.
2. The Option type in Scala is equivalent to Haskell's Maybe monad. It provides flatMap and map operations for monadic computations.
3. Scala supports parallel collections for parallelism and futures for composable concurrent programming. Futures are monads that can be operated on and composed asynchronously.
Tonka Waters West Girl Scout New Adult Members Training - Fast track v2hdurenbe
This document provides an overview of a training for new adult Girl Scout leaders. It discusses the purpose of building a strong foundation for the Scouting year. It also provides information on Girl Scout programs, events, and volunteer responsibilities like safety, membership, and finances. Leaders are encouraged to use tools like Google, SignUp Genius, and Shutterfly to plan meetings and communicate. The training emphasizes the importance of family involvement and working together in a cooperative model.
This document discusses operators in Java, including assignment, arithmetic, relational, and logical operators. It provides examples of using various operators and discusses some key points about operator precedence and equality testing. Specifically, it covers compound assignment operators, relational operators for comparison, and how equality is determined for primitives and object references. It also notes some topics about operators that are no longer covered on the Java certification exam.
This document discusses generics in Java and the benefits they provide. It explains that before generics, collections like ArrayList could hold multiple different types of objects, risking ClassCastExceptions. With generics, the type is specified within angle brackets, allowing the compiler to catch type errors and ensuring a collection only holds the specified type. An example shows how a non-generic list can hold integers and strings, while a generic list specified to hold integers no longer allows strings. Generics eliminate casting and type safety issues.
Some notes about programming in Scala: it covers Scala syntax and semantics, programming techniques, idioms, patterns. Many Scala features are introduced, from basic to intermediate and advanced. These are not introductory notes, but they assume a working knowledge with some other programming language (Java, C#, C++), object-oriented programming (OOP) concepts, and functional programming (FP) concepts.
Scala case classes provide a convenient way to pattern match on class types. Case classes automatically generate useful methods like equals, hashCode, and toString. When defining a case class, the constructor parameters become val fields of the class. This allows simple access and comparison of case class values. Case classes also avoid the need for the 'new' keyword when constructing new instances.
My talk at Bangalore Java Users Group. It was meant developers who want to get them started on Scala. This talk objectives was to get started on creating a project in Scala, write some code using collections and test it using ScalaTest.
This document provides a taxonomy of Scala concepts including object-oriented features, pattern matching, functional programming, actors, futures, implicits, type theory, macros, and category theory. It aims to serve as a reference for many of the terms used in the Scala community. The document covers topics such as case classes, lazy definitions, imports, objects, tuples, pattern matching examples, immutable collections, higher order functions, parallel collections, partial functions, currying, actors, futures, implicit conversions, implicit parameters, implicit classes, type inference, type classes, higher kinded types, algebraic data types, macros, concepts and arrows in category theory, morphisms, and functors.
Guava is Java libraries by Google.
This is Introduction of Guava with some API and sample codes.
Its samples are here.
http://www.slideshare.net/akirakoyasu/hello-guava-samples
The document discusses functional programming concepts in Scala including creating immutable objects to represent rational numbers, using pattern matching to add rationals, and defining classes with private fields and auxiliary constructors while avoiding side effects through immutable and functional design. It provides examples of functional programming techniques like creating rational number objects that are immutable and can be freely passed around without risk of mutation, and defining methods as functions that take arguments instead of mutating object state.
This document provides a summary of key concepts in Ruby including:
- Everything is an object in Ruby including true, false, nil
- Classes are defined using class, modules using module, and objects are created using Object.new
- Methods are defined using def, variables can have default values, and returns are not required
- Modules contain reusable code that can be included in classes
- Classes can inherit from other classes and modules can be mixed in
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.
This document provides an overview of functional programming concepts in Scala including:
- Scala supports both object-oriented and functional programming paradigms.
- Functional programming avoids side effects and uses immutable data and pure functions.
- Scala supports first-class functions, higher-order functions, and functional data structures like Options and Try.
- Functional patterns like mapping, filtering, and pattern matching help express programs concisely in a referentially transparent style.
Property based Testing - generative data & executable domain rulesDebasish Ghosh
- Property based testing verifies properties and invariants of code through automated generation of random test data rather than testing with specific hard-coded test cases. This helps uncover subtle bugs and edge cases.
- Key aspects include defining properties to specify constraints that must hold, using a library like ScalaCheck to generate random data and verify properties hold, and defining custom generators for domain-specific types.
- Properties can verify things like business rules of a domain model in a more abstract way compared to traditional unit tests.
Scala is a programming language that unifies object-oriented and functional programming. The document introduces Scala concepts including everything being an expression, pattern matching, and the type system. It discusses Scala's class hierarchy and data types. It also covers programming with Scala using the REPL, worksheets, and main and App objects. Finally, it provides an overview of object-oriented concepts in Scala like classes, traits, and case classes as well as functional concepts like anonymous functions, higher-order functions, and immutability.
Scala collections provide a uniform approach to working with data structures. They are generic, immutable, and support higher-order functions like map and filter. The core abstractions are Traversable and Iterable, with subclasses including lists, sets, and maps. Collections aim to be object-oriented, persistent, and follow principles like the uniform return type. They allow fluent, expressive ways to transform, query, and manipulate data in a functional style.
The document summarizes key points from a lecture on Scala programming:
1. Implicits allow defining implicit conversions to resolve type mismatches and fix compiler errors. Monads separate composition timeline from execution and allow computations to carry extra data.
2. The Option type in Scala is equivalent to Haskell's Maybe monad. It provides flatMap and map operations for monadic computations.
3. Scala supports parallel collections for parallelism and futures for composable concurrent programming. Futures are monads that can be operated on and composed asynchronously.
Tonka Waters West Girl Scout New Adult Members Training - Fast track v2hdurenbe
This document provides an overview of a training for new adult Girl Scout leaders. It discusses the purpose of building a strong foundation for the Scouting year. It also provides information on Girl Scout programs, events, and volunteer responsibilities like safety, membership, and finances. Leaders are encouraged to use tools like Google, SignUp Genius, and Shutterfly to plan meetings and communicate. The training emphasizes the importance of family involvement and working together in a cooperative model.
Scala is so flexible that it can be hard to know what it wants. Its syntax will give way and let you program in many different styles. The Scalactic library, on the other hand, quite opinionated about how you should program in Scala. It is guided by a specific philosophy. In this talk you'll find out what's in Scalactic, why it is there, and how you can take advantage of it in your projects.
Synthèse des travaux de groupe lors de l'atelier régional « Sécurisation foncière des exploitations familiales dans les grands périmètres irrigués d'Afrique de l'Ouest - Apprendre des expériences du Burkina Faso, Mali et Niger », qui s'est tenu à Ouagadougou du 17 au 19 juin 2016.
L'atelier était co-organisé par le Réseau des organisations paysannes et de producteurs de l’Afrique de l’Ouest (ROPPA) et la Global Water Initiative (GWI) en Afrique de l’Ouest – mise en œuvre par le consortium formé par l’Union internationale pour la conservation de la nature (UICN) et l’Institut international pour l’environnement et le développement (IIED), et financée par la Fondation Howard G. Buffett.
Sécurisation foncière des exploitations familiales dans les grands périmètres irrigués rizicoles en Afrique de l’Ouest
Communication d'André Tioro, chargé de programme sur le renforcement des capacités au Réseau des organisations paysannes et de producteurs de l’Afrique de l’Ouest (ROPPA), lors de l'atelier régional « Sécurisation foncière des exploitations familiales dans les grands périmètres irrigués d'Afrique de l'Ouest - Apprendre des expériences du Burkina Faso, Mali et Niger », qui s'est tenu à Ouagadougou du 17 au 19 juin 2016.
L'atelier était co-organisé par ROPPA et la Global Water Initiative (GWI) en Afrique de l’Ouest – mise en œuvre par le consortium formé par l’Union internationale pour la conservation de la nature (UICN) et l’Institut international pour l’environnement et le développement (IIED), et financée par la Fondation Howard G. Buffett.
Lecture du processus de sécurisation foncière en cours par les coopératives rizicoles
Communication de Ayouba Hassane, directeur de la Fédération des unions de coopératives de producteurs de riz du Niger (FUCOPRI), lors de l'atelier régional « Sécurisation foncière des exploitations familiales dans les grands périmètres irrigués d'Afrique de l'Ouest - Apprendre des expériences du Burkina Faso, Mali et Niger », qui s'est tenu à Ouagadougou du 17 au 19 juin 2016.
L'atelier était co-organisé par le Réseau des organisations paysannes et de producteurs de l’Afrique de l’Ouest (ROPPA) et la Global Water Initiative (GWI) en Afrique de l’Ouest – mise en œuvre par le consortium formé par l’Union internationale pour la conservation de la nature (UICN) et l’Institut international pour l’environnement et le développement (IIED), et financée par la Fondation Howard G. Buffett.
This document discusses using glass as a source of energy through a magnetic solar cell. It proposes focusing sunlight on glass using optical rectification to generate a direct current. However, analysis shows visible light does not have enough energy to excite the atoms in glass. The document then suggests using ultraviolet light instead, as it has higher energy levels that could potentially excite the glass atoms and enable direct current generation through optical rectification.
Este documento describe la cisticercosis y la tenia solium. La cisticercosis es una infección causada por la fase larvaria de la tenia solium, que normalmente infecta a los cerdos. Los síntomas incluyen formación de quistes en el músculo, tejido conectivo y cerebro. La neurocisticercosis puede causar hidrocefalia, meningitis y convulsiones. El diagnóstico se basa en hallazgos radiológicos y confirmación mediante pruebas. El tratamiento incluye prazicuantel y
This document provides information on the mission, vision, certifications, facilities, machinery, processes, and products of a company that manufactures custom designed heavy commercial vehicle bodies. The company's mission is to become a leading manufacturer in this industry by offering flexible, high-quality products at competitive rates. It aims to create a positive work environment for employees and maintain long-term relationships with vendors and suppliers. The company also strives to contribute to economic growth and environmental preservation in the local community.
This document is an offer letter from Haldia Petrochemicals Limited to Dharmaraj D Daddikar for the position of Assistant Manager- Manufacturing in Haldia. The letter outlines the salary components including basic pay, allowances, and benefits. The total cost to the company is Rs. 605,825 which includes a maximum performance linked pay of Rs. 94,721. The letter was rejected by Dharmaraj for delaying the offer for 2 months.
Custom flags can be designed and ordered for any occasion. A wide variety of flag styles, sizes, materials, and customization options are available to create the perfect flag for your needs. Customers can work with our designers to ensure their flag vision is brought to life.
Sharing is Caring - Web Development ResourcesTrevor Barnes
August 2014 Michigan State University WebDev Forum - "Sharing is Caring"
With web development changing so quickly these days, it’s more important than ever for us to share with fellow developers. We’ll take a look at some of our favorite front-end tools, techniques, and resources that we rely on to keep up to date with a modern web development workflow.
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
Some key features of Scala include:
1. It allows blending of functional programming and object-oriented programming for more concise and powerful code.
2. The static type system allows for type safety while maintaining expressiveness through type inference, implicits, and other features.
3. Scala code interoperates seamlessly with existing Java code and libraries due to its compatibility with the JVM.
(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.
Scala is a multi-paradigm programming language that supports functional, object-oriented and imperative programming paradigms. The document discusses Scala's support for types, expressions, objects, functions, and provides examples of using Scala for expressions, functions, control structures, patterns, spaces and actors.
The document discusses Scala as a potential replacement for Java on the JVM. It provides quotes from several influential Java developers who express their view that Scala is the most capable replacement for Java currently available on the JVM, and the momentum behind Scala is growing. The document also briefly outlines an agenda for introducing Scala, covering basic syntax, patterns, functions, classes and traits.
Scala is a multi-paradigm programming language that blends object-oriented and functional programming. It is designed to express common programming patterns in a concise, elegant, and type-safe way. Scala runs on the Java Virtual Machine and interoperates seamlessly with Java, but also integrates concepts from languages such as Haskell, ML and Ruby. Some key features of Scala include support for functional programming, a static type system with type inference, pattern matching, actors and immutable data structures.
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.
This document provides an introduction and overview of functional programming and the Scala programming language. It discusses the motivation for functional programming, including the benefits of avoiding side effects and mutable state. Some key aspects of functional programming covered include pure functions, immutable values, avoiding side effects, and function composition. The document then provides a high-level introduction to Scala, explaining that it supports both object-oriented and functional paradigms on the JVM. Some basic Scala concepts demonstrated include variables, methods, collections, pattern matching, and higher-order functions.
Slides from Scala workshop held at Schibsted Tech Polska office in Krakow October 2017. Covers topics like basic language features, expressions, methods, functions, collections, pattern matching, laziness, implicits, DSLs and more.
This document provides an agenda and overview for a Spark workshop covering Spark basics and streaming. The agenda includes sections on Scala, Spark, Spark SQL, and Spark Streaming. It discusses Scala concepts like vals, vars, defs, classes, objects, and pattern matching. It also covers Spark RDDs, transformations, actions, sources, and the spark-shell. Finally, it briefly introduces Spark concepts like broadcast variables, accumulators, and spark-submit.
This document discusses monads and continuations in functional programming. It provides examples of using monads like Option and List to handle failure in sequences of operations. It also discusses delimited continuations as a low-level control flow primitive that can implement exceptions, concurrency, and suspensions. The document proposes using monads to pass implicit state through programs by wrapping computations in a state transformer (ST) monad.
Java 8 introduces lambda expressions and default interface methods (also known as virtual extension methods) which allow adding new functionality to existing interfaces without breaking backwards compatibility. While this helps add lambda support to existing Java collections, it has limitations compared to Scala's approach using traits, which allow true multiple inheritance of both behavior and state in a typesafe manner. Scala also introduced the "pimp my library" pattern using implicits which allows extending existing classes with new methods, providing more flexibility for library evolution than Java 8's virtual extension methods.
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.
We have compiled the most important slides from each speaker's presentation. This year’s compilation, available for free, captures the key insights and contributions shared during the DfMAy 2024 conference.
ACEP Magazine edition 4th launched on 05.06.2024Rahul
This document provides information about the third edition of the magazine "Sthapatya" published by the Association of Civil Engineers (Practicing) Aurangabad. It includes messages from current and past presidents of ACEP, memories and photos from past ACEP events, information on life time achievement awards given by ACEP, and a technical article on concrete maintenance, repairs and strengthening. The document highlights activities of ACEP and provides a technical educational article for members.
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELgerogepatton
As digital technology becomes more deeply embedded in power systems, protecting the communication
networks of Smart Grids (SG) has emerged as a critical concern. Distributed Network Protocol 3 (DNP3)
represents a multi-tiered application layer protocol extensively utilized in Supervisory Control and Data
Acquisition (SCADA)-based smart grids to facilitate real-time data gathering and control functionalities.
Robust Intrusion Detection Systems (IDS) are necessary for early threat detection and mitigation because
of the interconnection of these networks, which makes them vulnerable to a variety of cyberattacks. To
solve this issue, this paper develops a hybrid Deep Learning (DL) model specifically designed for intrusion
detection in smart grids. The proposed approach is a combination of the Convolutional Neural Network
(CNN) and the Long-Short-Term Memory algorithms (LSTM). We employed a recent intrusion detection
dataset (DNP3), which focuses on unauthorized commands and Denial of Service (DoS) cyberattacks, to
train and test our model. The results of our experiments show that our CNN-LSTM method is much better
at finding smart grid intrusions than other deep learning algorithms used for classification. In addition,
our proposed approach improves accuracy, precision, recall, and F1 score, achieving a high detection
accuracy rate of 99.50%.
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesChristina Lin
Traditionally, dealing with real-time data pipelines has involved significant overhead, even for straightforward tasks like data transformation or masking. However, in this talk, we’ll venture into the dynamic realm of WebAssembly (WASM) and discover how it can revolutionize the creation of stateless streaming pipelines within a Kafka (Redpanda) broker. These pipelines are adept at managing low-latency, high-data-volume scenarios.
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSIJNSA Journal
The smart irrigation system represents an innovative approach to optimize water usage in agricultural and landscaping practices. The integration of cutting-edge technologies, including sensors, actuators, and data analysis, empowers this system to provide accurate monitoring and control of irrigation processes by leveraging real-time environmental conditions. The main objective of a smart irrigation system is to optimize water efficiency, minimize expenses, and foster the adoption of sustainable water management methods. This paper conducts a systematic risk assessment by exploring the key components/assets and their functionalities in the smart irrigation system. The crucial role of sensors in gathering data on soil moisture, weather patterns, and plant well-being is emphasized in this system. These sensors enable intelligent decision-making in irrigation scheduling and water distribution, leading to enhanced water efficiency and sustainable water management practices. Actuators enable automated control of irrigation devices, ensuring precise and targeted water delivery to plants. Additionally, the paper addresses the potential threat and vulnerabilities associated with smart irrigation systems. It discusses limitations of the system, such as power constraints and computational capabilities, and calculates the potential security risks. The paper suggests possible risk treatment methods for effective secure system operation. In conclusion, the paper emphasizes the significant benefits of implementing smart irrigation systems, including improved water conservation, increased crop yield, and reduced environmental impact. Additionally, based on the security analysis conducted, the paper recommends the implementation of countermeasures and security approaches to address vulnerabilities and ensure the integrity and reliability of the system. By incorporating these measures, smart irrigation technology can revolutionize water management practices in agriculture, promoting sustainability, resource efficiency, and safeguarding against potential security threats.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTjpsjournal1
The rivalry between prominent international actors for dominance over Central Asia's hydrocarbon
reserves and the ancient silk trade route, along with China's diplomatic endeavours in the area, has been
referred to as the "New Great Game." This research centres on the power struggle, considering
geopolitical, geostrategic, and geoeconomic variables. Topics including trade, political hegemony, oil
politics, and conventional and nontraditional security are all explored and explained by the researcher.
Using Mackinder's Heartland, Spykman Rimland, and Hegemonic Stability theories, examines China's role
in Central Asia. This study adheres to the empirical epistemological method and has taken care of
objectivity. This study analyze primary and secondary research documents critically to elaborate role of
china’s geo economic outreach in central Asian countries and its future prospect. China is thriving in trade,
pipeline politics, and winning states, according to this study, thanks to important instruments like the
Shanghai Cooperation Organisation and the Belt and Road Economic Initiative. According to this study,
China is seeing significant success in commerce, pipeline politics, and gaining influence on other
governments. This success may be attributed to the effective utilisation of key tools such as the Shanghai
Cooperation Organisation and the Belt and Road Economic Initiative.
1. Equality For All!
Scala by the Bay, 2014
BillVenners
Artima, Inc.
Escalate Software
Saturday, August 9, 2014
2. Equality: An equivalence relation with
one element per equivalence class
42 4341
42 = 4241 = 41 43 = 43
reflexive: x = x
symmetric: x = y iff y = x
transitive: if x = y and y = z then x = z
Saturday, August 9, 2014
3. How do I say forty two in code?
Let me count the ways...
42
42L
42.0
42.0F
42.toShort
'*'
42.toByte BigInt(42)
BigDecimal(42)
new java.lang.Integer(42)
new java.lang.Long(42L)
new java.lang.Double(42.0)
new java.lang.Float(42.0F) new java.lang.Short(42.toShort)
new java.lang.Character(42)
new java.lang.Byte(42.toByte)
new java.math.BigInteger("42")
new java.math.BigDecimal(42) Complex(42.0, 0.0)
DigitString("42") DigitString("042")
Saturday, August 9, 2014
4. The equals method implements an equivalence relation on non-null object references:
• It is reflexive: for any non-null reference value x, x.equals(x) should return true.
• It is symmetric: for any non-null reference values x and y, x.equals(y) should return true
if and only if y.equals(x) returns true.
• It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true
and y.equals(z) returns true, then x.equals(z) should return true.
• It is consistent: for any non-null reference values x and y, multiple invocations of
x.equals(y) consistently return true or consistently return false, provided no
information used in equals comparisons on the objects is modified.
• For any non-null reference value x, x.equals(null) should return false.
Java's equals contract
public boolean equals(Object obj)
final def == (other:Any): Boolean
Saturday, August 9, 2014
8. scala> "forty two" == 42
res19: Boolean = false
scala> List(mutable.Set(Map(Some(4L) -> BigInt(2)))) ==
Vector(Set(mutable.Map(Some("4.0") -> new java.lang.Long(2L))))
res23: Boolean = false
Wanted: Type errors
But how to decide which comparisons compile?
Saturday, August 9, 2014
9. scala> "forty two" == 42
<console>:20: error: types String and Int do not adhere to the
type constraint selected for the === and !== operators; the
missing implicit parameter is of type
org.scalactic.EqualityConstraint[String,Int]
"forty two" === 42
^
scala> BigInt(42) === BigDecimal(42)
res1: Boolean = true
Fail to compile if L can never equal R.
Saturday, August 9, 2014
10. scala> Vector.empty === List.empty
<console>:20: error: ambiguous implicit values:
both method conflictingEmptySeqConstraint1 in object EqualityConstraint of type [LSEQ[e] <:
scala.collection.GenSeq[e], RSEQ[e] <: scala.collection.GenSeq[e]]=>
org.scalactic.EqualityConstraint[LSEQ[Nothing],RSEQ[Nothing]]
and method conflictingEmptySeqConstraint2 in object EqualityConstraint of type [LSEQ[e] <:
scala.collection.GenSeq[e], RSEQ[e] <: scala.collection.GenSeq[e]]=>
org.scalactic.EqualityConstraint[LSEQ[Nothing],RSEQ[Nothing]]
match expected type
org.scalactic.EqualityConstraint[scala.collection.immutable.Vector[A],List[Nothing]]
Vector.empty === List.empty
^
scala> Vector.empty === List.empty[Int]
res3: Boolean = true
scala> Vector.empty[String] === List.empty
res4: Boolean = true
Fail to compile if L will always equal R.
Saturday, August 9, 2014
11. Candidate rule:
To compile, an equality comparison
must be interesting: values of types L
and R can be either equal or unequal.
Saturday, August 9, 2014
12. scala> case class Complex(real: Double, imaginary: Double)
defined class Complex
scala> implicit def convertIntToComplex(i: Int): Complex = Complex(i, 0.0)
convertIntToComplex: (i: Int)Complex
scala> 42 === Complex(42, 0)
<console>:24: error: types Int and Complex do not adhere to the type constraint selected for the
=== and !== operators; the missing implicit parameter is of type
org.scalactic.EqualityConstraint[Int,Complex]
42 === Complex(42, 0)
^
scala> Complex(42, 0) === 42
<console>:24: error: types Complex and Int do not adhere to the type constraint selected for the
=== and !== operators; the missing implicit parameter is of type
org.scalactic.EqualityConstraint[Complex,Int]
Complex(42, 0) === 42
^
What about implicit conversions?
Saturday, August 9, 2014
13. scala> implicit val enabler = EqualityEnabledBetween[Int, Complex]
enabler: org.scalactic.EqualityEnabledBetween[Int,Complex] =
org.scalactic.EqualityEnabledBetween@e5d2d9b
scala> 42 === Complex(42, 0)
res2: Boolean = true
scala> Complex(42, 0) === 42
res3: Boolean = true
scala> new AnyShouldWrapper(1) === 1 // Probably shouldn't enable...
Intuition: enable some but not all
But what would the rule be?
Saturday, August 9, 2014
14. OK if the conversion is an injection
scala> case class DigitString(digits: String) {
| val toInt: Int = digits.toInt
| }
defined class DigitString
scala> implicit def convert(d: DigitString): Int =
| d.digits.toInt
convertDigitStringToInt: (d: DigitString)Int
scala> DigitString("42") === DigitString("042")
res0: Boolean = false
scala> DigitString("42").toInt === DigitString("042").toInt
res1: Boolean = true
John C. Reynolds: Using category theory to design implicit conversions and generic operators.
Saturday, August 9, 2014
15. How to decide:
1.To compile, an equality comparison must be
interesting: values of types L and R can be either
equal or unequal.
2.Allow select implicit conversions to be enabled,
and recommend that non-widening conversions
(non-injections) not be enabled.
Saturday, August 9, 2014
16. scala> (Some(1): Option[Int]) === Some(1)
res0: Boolean = true
scala> Some(1) === (Some(1): Option[Int])
res1: Boolean = true
scala> Some(1) === Some(1)
res2: Boolean = true
What about the implicit conversion
from subtype to supertype (<:<)?
Saturday, August 9, 2014
17. scala> def eqv[T](a: T, b: T): Boolean = a === b
eqv: [T](a: T, b: T)Boolean
scala> eqv(1, ())
res3: Boolean = false
scala> ((i: Int) => i + 1) === ((i: Int) => i + 1)
res4: Boolean = false
Even though <:< is an injection, is it
always desireable?
Saturday, August 9, 2014
19. scala> import EnabledEquality._
import EnabledEquality._
scala> def eqv[T](a: T, b: T): Boolean = a === b
<console>:19: error: types T and T do not adhere to the type constraint selected for
the === and !== operators; the missing implicit parameter is of type
org.scalactic.EqualityConstraint[T,T]
def eqv[T](a: T, b: T): Boolean = a === b
^
scala> ((i: Int) => i + 1) === ((i: Int) => i + 1)
<console>:20: error: types Int => Int and Int => Int do not adhere to the type
constraint selected for the === and !== operators; the missing implicit parameter is
of type org.scalactic.EqualityConstraint[Int => Int,Int => Int]
((i: Int) => i + 1) === ((i: Int) => i + 1)
^
EnabledEquality benefit
Saturday, August 9, 2014
20. scala> case class Person(name: String)
defined class Person
scala> Person("Sue") === Person("Sue")
<console>:22: error: types Person and Person do not adhere to the type constraint
selected for the === and !== operators; the missing implicit parameter is of type
org.scalactic.EqualityConstraint[Person,Person]
Person("Sue") === Person("Sue")
^
scala> implicit val enabler = new EqualityEnabledFor[Person]
enabler: org.scalactic.EqualityEnabledFor[Person] =
org.scalactic.EqualityEnabledFor@1289d391
scala> Person("Sue") === Person("Sue")
res2: Boolean = true
EnabledEquality cost
Saturday, August 9, 2014
21. scala> 1 should === ("one")
<console>:23: error: types Int and String do not adhere to the type constraint selected for the === and !==
operators; the missing implicit parameter is of type org.scalactic.Constraint[Int,String]
1 should === ("one")
^
scala> 1 should equal ("one")
<console>:23: error: could not find implicit value for parameter typeClass1:
org.scalactic.enablers.EvidenceThat[String]#CanEqual[Int]
1 should equal ("one")
^
scala> 1 should be ("one")
<console>:23: error: could not find implicit value for parameter typeClass1:
org.scalactic.enablers.EvidenceThat[String]#CanEqual[Int]
1 should be ("one")
^
scala> 1 should be_== ("one")
org.scalatest.exceptions.TestFailedException: 1 was not equal to "one"
ScalaTest's equal, be, and be_==
Saturday, August 9, 2014
22. scala> List(1, 2, 3) should contain ("one")
<console>:23: error: could not find implicit value for parameter typeClass1:
org.scalactic.enablers.EvidenceThat[String]#CanBeContainedIn[List[Int]]
List(1, 2, 3) should contain ("one")
^
scala> List(1, 2, 3) should contain oneOf ("one", "two")
<console>:23: error: could not find implicit value for parameter evidence:
org.scalactic.enablers.EvidenceThat[String]#CanBeContainedIn[List[Int]]
List(1, 2, 3) should contain oneOf("one", "two")
^
scala> 1 isIn List(1, 2, 3)
res14: Boolean = true
scala> "one" isIn List(1, 2, 3)
<console>:23: error: Could not find evidence that String can be contained in List[Int]; the missing implicit
parameter is of type org.scalactic.enablers.ContainingConstraint[List[Int],String]
"one" isIn List(1, 2, 3)
^
ScalaTest's contain, Scalactic's isIn/isNotIn
Saturday, August 9, 2014
23. if sufficientTimeRemains then (Q => A) else thanks
artima.com/shop
15% discount
coupon code:
BYTHEBAY2014
Saturday, August 9, 2014
24. scala> 1L === 1
res0: Boolean = true
scala> 1 === 1L
<console>:14: error: could not find implicit value for parameter F0:
scalaz.Equal[Any]
1 === 1L
^
Scalaz or Spire
Scalactic
scala> 1L === 1
res7: Boolean = true
scala> 1 === 1L
res8: Boolean = true
Equal[T], Eq[T]
EqualityConstraint[L, R]
Equivalence[T]
Saturday, August 9, 2014