• Background Image


    Do you have an awesome idea or pressing problem
    that can be solved with technology?

    Contact Us

    or call us @ +1-(855)-556-3425



Getting Started with Scala – Installing Scala

I’ve been having this itch lately to try out some new languages than my primary language – Ruby. The idea is to just branch and develop new skills and learn more. Before marching on onto this new excursion I had a few pre-requisites in mind, the new language should be:

  1. Functional. (No specific reason, just to polish my functional skills a tad more)
  2. Fast.
  3. Elegant Concurrency model.
  4. Fun to write and test.
  5. Nice and Easily searchable documentation.

I had a few choices at hand, such as Go Lang, Scala and Erlang etc. All of these languages are well known and respected within the community for their robustness and stability. Some of these languages have been making quite some news among the community as well.

So, why Scala?

After doing some research on some of the above mentioned languages I finally chose Scala for two reasons over others:

  1. There are some striking similarities between some constructs in Scala and Ruby – So I’m hoping it’ll be easier to pick up the language. Checkout thispresentation.
  2. No need to put at the end of each line. This one is probably the most important aspect. :)

Installing Scala

The below instructions are for Mac OS X, should work equally well on a Linux machine but there might be some nuances. Let me know in the comments if you come across any issues.

  1. Make sure you have Java installed.
  2. Download Scala from: http://www.scala-lang.org/download/
  3. Extract the .tgz file.
  4. Move directory to your /usr/bin/scala
  5. Add /usr/bin/scala/bin to your /etc/paths file.
  6. Reload your terminal.

Now, Scala should be installed on your computer, and you shall be able to load up the Scala REPL by just typing scala in your terminal.

Now, I’m all set to crank out some Scala code and learn more. If you are en-route this journey of learning Scala, feel free to leave your comments and share your experience.

:~ jasdeep$ scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.

scala> println("Hello world!")
Hello world!



If you are using Signature pad(jQuery plugin) to get signatures from the users. You may want to convert that JSON string to an image so as to stick that image in the web app or something similar. In this tutorial I’m assuming that you have the following things already setup in your Ruby on Rails application, if not please use the following links to set them up:

  1. Signature pad: http://thomasjbradley.ca/lab/signature-pad/
    1. in Future I might write a quick Rails gem for this jQuery plugin to integrate it into your asset pipeline. But for now lets just use this.
  2. Carrierwave: https://github.com/carrierwaveuploader/carrierwave
    1. Video tutorial by Ryan Bates: Uploading to Amazon S3 
    2. As an alternative you can use paperclip << see the video tutorial to setup here

Once you have setup these 2 things you are all ready rock and create some graphics out of those JSON strings, so lets jump to the code now:

In this case the signature string is stored in the signature column and this will generate an image in the “tmp” folder with timestamp so that a unique file is created. “signature_image” is the column where Carrierwave uploader is mounted.

If you have setup your Carrierwave and Fog gem correctly this will work.

Background Image

Come on. We have introduced ourself much. Just leave a message or call us @
+1 (855) 556 3425

1 Yonge St., Suite 1801, Toronto, On, M5E 1W7, Canada


© Copright 2015 Metaware Labs - All Rights Reserved