Showing posts with label Scala. Show all posts
Showing posts with label Scala. Show all posts

Thursday, April 19, 2012

Scala 2.9.2 final released

Scala has been released new stable version which is 2.9.2 final, it has addresses several bug fixes and additional improvements

You can find out more information about release 2.9.2 here

Monday, April 9, 2012

Cassovary - Big Graph-Processing Library

Twitter open sourced Cassovary, it's a big graph-processing library for the Java Virtual Machine (JVM) written in Scala.


As per twitter blog,It's used twitter's graph-based features such as "Who to Follow" and "Similar to",etc.


If you have any queries, raise it on mailing list or issues on GitHub.

Saturday, April 7, 2012

Scala Basics - Simple Class

Simple class definition
scala> class User {
   val userName:String ="Steve Kent"
   def getUserName(firstName: String, lastName:String): String = firstName + " " + lastName
 }  
 defined class User

Define object of the Class
scala> scala> var user = new User
user: User = User@1fce2f2

Access Class members through Object
scala> scala> scala> user.getUserName("sam","anderson")
res1: String = sam anderson

Wednesday, April 4, 2012

Scala 2.9.2 RC2!

Scala 2.9.2 RC2 is available for testing purpose. It has lots of bug fixes and changes.

You can download it here.

Tuesday, April 3, 2012

Scala Basics - Anonymous Functions

Simple way to create anonymous functions on Scala

scala> (result: String) => "Hello " + result
res0: String => java.lang.String = <function1>
It adds "Hello" to an String result, so we call this function like this
scala> res0("Scala")
res2: java.lang.String = Hello Scala

Pass anonymous functions into vals
scala> val welcome = (result: String) => "Hello " + result
welcome: String => java.lang.String = <function1>

scala> welcome("Scala")
res3: java.lang.String = Hello Scala

Expressions - {}
You can define expressions like this
scala> def welcome(message: String): String = {
    "Hello " + message
}
welcome: (message: String)String

scala> welcome("world")
res4: String = Hello world


scala> def addition(i: Int): Int = {
     i + 10
}

Real anonymous function
scala> { message: String =>
       "Hello " + message
 }
res5: String => java.lang.String = <function1>
scala> res5("Anonymous function")
res6: String = Hello Anonymous function

Thursday, March 29, 2012

Scala Basics - Functions

You can define function with "def"

scala> def pageVisitCount(session: Int): Int = session + 1 pageVisitCount: (session: Int)Int scala> var totalPageCount = pageVisitCount(1) totalPageCount: Int = 2 scala> def message() = "Hello Scala" message: ()java.lang.String scala> message() res0: java.lang.String = Hello Scala scala> message res1: java.lang.String = Hello Scala
Even you can able to call function without parenthesis if it doesn't have arguments.

Scala Basics - Variables


You can define variable by "var" keyword

scala> var message="Hello Scala" message: java.lang.String = Hello Scala scala> var count=7 count: Int = 7
These two example we have created variables of type String and Int.Remember you can able to change message and count binding, since it's declared by "var".

Scala Basics - Simple Expression

Here is simple expression in Scala.

Scala> 7 + 7 res0: Int = 14 Scala> 4.5+9.3 res0: Double = 13.8
Scala interpreter automatically created value name(res0) for result of the expression. Last expression, res0 has Double type and stores 13.8 value.

You can define you're own name for a expression through "val".

scala> val result = 4*5 result: Int = 20
You cann't change the binding to a val.Almost everything in Scala is an expression.

Wednesday, March 28, 2012

Scala Basics - Interpreter for testing/learning!

Once you're machine installed with scala, then starting scala interpreter is easy

Note: refer this post for Scala install instructions for Ubuntu

$ scala

Welcome to Scala version 2.9.1.final (Java HotSpot(TM) Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.

scala>

Now you're machine is ready for testing Scala code!

Monday, March 26, 2012

Scala - General Information

Scala is a concise, elegant, type-safe programming language that integrates object-oriented and functional features.It is fully interoperable with Java.

Scala and Java
Scala programs run on the Java Environment(JVM), so it compatible with Java. it makes Scala to use any existing Java Libraries/Applications.

Scala can able to calls/refers any Java code similarly Java can calls/refers any Scala code.

Scalar compiler performance is more reliable and well supports Java Byte Code.

Latest stable release & more information available here.

Thursday, March 22, 2012

Scala 2.9.2 RC1

Scala 2.9.2 RC1 is available, it includes many bugfixes,but for testing purpose only.

More information available here.

Saturday, March 17, 2012

Typesafe Stack - Release 2.0

Typesafe stack has been release version 2.0. Install instructions are available here for different operating system.

What's TypeSafe?

It's a stack for builing scalable software applications in Java and Scala. It includes

1. Scala

It's a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive.

2. Akka

It's a event-driven middleware, with Scala and Java APIs.

3. Play

It's a Scala framework - easier to build web applications with Java & Scala.


Go through Documents and try different (giter8) template projects available.

Saturday, March 3, 2012

Scala Driver for MongoDB - Casbah


Casbah is an interface for MongoDB designed to provide more flexible access from both Java and Scala. While the current core focus is on providing a Scala oriented wrapper interface around the Java mongo driver, support for other JVM languages may come in the future.
For the Scala side, contains series of wrappers and DSL-like functionality for utilizing MongoDB from within Scala. This currently utilises the very Java-oriented Mongo Java driver, and attempts to provide more scala-like functionality on top of it. This has been tested with MongoDB 1.2.x+ and v2.x of the Mongo java driver.
Tutorial and more information available here.

Monday, February 27, 2012

Install & Setup Scala 2.9.1 on Ubuntu 11.10

To install Scala 2.9.1, we need Scala distribution, so you can get you're operating system release from here.

Follow these steps to install Scala 2.9.1

1. Download 2.9.1 release from this link
$ wget http://www.scala-lang.org/downloads/distrib/files/scala-2.9.1.final.tgz
$ chmod +x scala-2.9.1.final.tgz

2. Extract downloaded file into /user/local
$ sudo tar -zxvf scala-2.9.1.final.tgz -C /usr/local/

3. Add Scala installed folder path on .bashrc(/home/username/.bashrc) file

$ sudo vim /home/username/.bashrc
Add below line at the end of the file

export SCALA_HOME='/usr/local/scala-2.9.1.final';

4 . Run Scala console

$ Scala


Now Scala 2.9.1 ready to use on you're machine. Hope it may helpful to install and setup Scala 2.9.2.

Sunday, February 26, 2012

Scala/Hadoop - Scoobi


Scoobi is a Scala productivity framework for Hadoop. Its a Scala library that focuses on making you more productive at building Hadoop applications. It stands on the functional programming shoulders of Scala and allows you to just write what you want rather than how to do it.

Scoobi is a library that leverages the Scala programming language to provide a programmer friendly abstraction around Hadoop's MapReduce to facilitate rapid development of analytics and machine-learning algorithms.

Quick start,download and more information available here.

Tuesday, February 21, 2012

Play 2.0 RC1 - Scala Web application framework


Play 2.0 RC1 is a high productivity Java and Scala Web application framework, integrating all components and API needed for modern Web application development.
It is based on a lightweight stateless Web friendly architecture and features predictable and minimal resources consumption (CPU, Memory, Threads) for highly scalable applications thanks to its reactive model based on Iteratee IO.

Try first release candidate.

Monday, January 16, 2012

Scala IDE - Eclipse 2.0.0


Features

Support for Mixed Scala/Java Projects
Code Completion
Definition Hyperlinking
Inferred Type Hovers
Error Markers
Integrated Debugger

Download it from here

Sunday, June 19, 2011

Scala IDE for Eclipse 2.0.0 beta 5 - Scala 2.9.0-1 and 2.8.2-SNAPSHOT available now!

Find the downloadable archives of builds on the Scala IDE download site.

Scala 2.9.0.1

Scala releasing a minor update to the Scala 2.9.0 code. It addresses a couple of issues found in 2.9.0, and is currently available from our Download Page.

The 2.9.0.1 release includes the following fixes with respect to 2.9.0:

Change Summary
24881 Closes #4537 regression: Compiler crash for private object that shadows outer definition
24956 Fix for view+groupBy regression, closes #4558
24962 Fix for Iterator flattening performance degradation
24966 Removed bridge method that caused load problems in tomcat due to verification error
24967 Removed two more @bridge methods related to 24966.
24968 Fixes #4560 regression: Runtime exception on structural reflection
24991 Fixes #4608: flatten on a ParSeq
24992 Specialized keySets are supposed to be views, #4616
24993 Literal(0) vs Literal(0.0f), Closes #4617 regression with local lazy vals of type Float or Double.

It is also available in a simple, pre-integrated stack with Akka 1.1.2 from Typesafe. The Typesafe Installer v1.0.1 will be shortly available from the Stack Download page.

Here's more info on the Scala 2.9.0 distribution.

Google paper comparing performance of C++, Java, Scala, and Go

In scala day 2011, talk by Googler Robert Hundt was a performance benchmark comparing C++/Scala/Java/Go.

C++ offers the fastest runtime of the four languages. But, the paper says, it also requires more extensive "tuning efforts, many of which were done at a level of sophistication that would not be available to the average programmer."

Go is designed to remove at least some of this limitation, but it's still young (it debuted about a year and a half years ago as an "experimental" language), and on most of Google's performance tests, it trailed C++ as well as Java and Scala. "Go offers interesting language features, which also allow for a concise and standardized notation," reads the paper, penned by Googler Robert Hundt. "[But] the compilers for this language are still immature, which reflects in both performance and binary sizes