background preloader

Scala

Facebook Twitter

Jedesah/scala-codesheet-api · GitHub. CodeBrew - Scala worksheet in your browser. Getting started with a simple SBT project. In previous article, we learned how to install and setup sbt, so now let’s try to create a simple sbt project.

Getting started with a simple SBT project

There are few ways to create a sbt project from scratch. Folder with source files.

Akka

BirdWatch explained - Matthias Nehlsen. BirdWatch is an open-source reactive web application that consumes the Twitter Streaming API for a selection of terms.

BirdWatch explained - Matthias Nehlsen

It processes those matching tweets in a server side application that is based on Play Framework. The tweets are then stored inside ElasticSearch, where they are available for complex full-text searches. On the client side, a Single Page Application based on AngularJS allows the user to perform a live search for tweets with certain keywords and to do some analysis on them, such as word count statistics, activity over time and sorting results by followers and retweet counts. Searches are conducted in real time thanks to so called Percolation queries within ElasticSearch. Besides being used to retrieve previous matches, each search is also registered with ElasticSearch.

Here is an architectural overview with a focus on the Twitter client: TwitterClient Actor So what is an Actor? Actors are very lightweight concurrent entities. Let’s have a look at the source code. Controller. Using WebSockets with Play Framework 2.1.0 in Scala. Systems Programming at Twitter. Facebook, October 30, 2012 Marius Eriksen Twitter Inc.

Systems Programming at Twitter

(Press space or enter to navigate to the next slide, left arrow to go backwards.) A history lesson Twitter evolves 2009: Pure Ruby-on-Rails app with MySQL; lots of memcache. This is the context of our work. Late 2012 architecture Many open source components Memcache, redis, MySQL, etc. Organized around services Distinct responsibilities Isolated from each other Distributed computation and data RPC between systems Multiplexing HTTP frontend Crucial for modularity, load balancing A systems software stack Programming the datacenter Concerns include Partial failures Deep memory hierarchies Split heaps Dynamic topologies Changes in variance, latency tails Heterogeneous components Operator errors Taming the resulting complexity is the central theme of our work.

Languages and tools Mismatch of world views: Languages and tools target single computers, but our applications demand the simultaneous use of 1000s—a datacenter! Concurrent systems. Learning Scala part seven - Traits. In this part of the Learning Scala series we’ll look at traits which is one of the features of Scala that appeals the most to me as a C# developer.

Learning Scala part seven - Traits

Traits can be thought of as interfaces in which it’s possible, but not necessary, to provide implementations for all or some of the methods that the interface defines. Or, by looking at traits from a different perspective we can also think of them as classes that can’t have constructor parameters. We can also think of the concept as multiple inheritance without some of it’s dangers but with some limitations. An example with birds Let’s look at a simple and contrived example.

Android

Reader/Writer/State transformer in Scala. Blog. Computer Language Benchmarks Game. Performance measurements Each table row shows performance measurements for this Scala program with a particular command-line input value N.

Computer Language Benchmarks Game

Read the ↓ make, command line, and program output logs to see how this program was run. Read pidigits benchmark to see what this program should do. notes java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) Scala compiler version 2.10.3 -- Copyright 2002-2013, LAMP/EPFL pidigits Scala #4 program source code make, command-line, and program output logs.

Web framework

Scala, lazy evaluation and the Sieve of Eratosthenes. This blog posting is primarily concerned with looking at lazy evaluation in functional programing, what it means and how it can be put to use.

Scala, lazy evaluation and the Sieve of Eratosthenes

Lazy evaluation can be described as an expression that has a value, but that is not evaluated until it's actually needed. Conversely strict refers to the opposite property where all expressions are evaluated up front when declared. Some functional languages are described as Pure Lazy (no, this is not a derogatory term!) , to reflect the fact that all evaluation is performed on demand. Haskell is on such language. By means of the simplest example I can think of to illustrate Lazy evaluation, consider the following interaction with the Scala CLI: Java - Basic Insertion sort in Scala, port of Haskell version. Exploring Android - Stephane's Homepage. This page is about developing Android applications written in the Scala programming language.

Exploring Android - Stephane's Homepage

Our objectives are primarly to share our personal experience and to create emulation among the Android and Scala programmer communities. We kindly thank all people who submitted comments and questions about this work, in particular Johannes, Kevin and Will. Articles In this series of articles we promote the adoption of the Scala language for developing Android applications and share our experience integrating the Scala development tools with the Android framework. Examples The following .zip archive files contain Android examples written in Scala respectively in Java together with configuration files for Apache Ant and the Scala IDE Plugin for Eclipse. Last updated on January 8, 2012.