Blog Posts

When you need to build your Scala project, but have no way to install SBT on your host, you can still do it if you have Docker.

There are few ready to use container images on DockerHub. We create our own.

All we need for that is to prepare a Dockerfile:

 FROM java:latest  
MAINTAINER Nikolay Kushin nikolay@indoo.rs
ENV SCALA_VERSION 2.11.7
ENV SBT_VERSION 0.13.9
ENV SBT_OPTS -Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Xss2M -Duser.timezone=GMT
# install sbt
RUN wget https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb
RUN dpkg -i sbt-$SBT_VERSION.deb
# install scala
RUN wget https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.deb
RUN dpkg -i scala-$SCALA_VERSION.deb
# fetch base dependencies
RUN sbt compile
VOLUME /src
WORKDIR /src
CMD ["sbt"]

Our Dockerfile is relatively easy and self-explaining.

Next step is to build an image. Save Dockerfile in some folder and execute following commande in terminal:

 docker build -t sbt-docker .  

Now when the image is ready we can create container with mounted source folder, containing our Scala project and run SBT.

 docker run -it --rm -v $(pwd):/src sbt-docker sbt docker:stage  

Thats it! Enjoy!
Simply run following script to install latest Scala and SBT on your Ubuntu:
The past weekend I was lucky enough to participate in an event held by Koding (http://koding.com) titled "Global Hackathon" (https://koding.com/Hackathon).
Hackathon - is a kind of time-limited events, where participants work on projects for which in ordinary daily life there is no time as a rule. The main idea is to bring the idea to the finished prototype of the final product in the shortest possible time. Hackathon is named this way because participants can use all possible tools and ways to achieve this goal.


file-2.pngThe event was attended by 2000 teams from all around the world, selected from more than 19,000 applications. Maximum number of participants in the team was equal to 5. Many people like me was not fortunate enough to find teammates and had to work alone. 51 of the judges will find winners among completed projects and the most worthy of them will be awarded.

Weiterlesen »

i uploaded my slides from my talk at scala-vienna user group. i present two plugin for easier file resource handing and image resizing on-the-fly.

CloudControl (https://www.cloudcontrol.com) is a Platform as a Service solution.

You can deploy on it Java  NodeJS  PHP  Python  Ruby applications as well as a lot of Third-Party Buildpacks including Scala/Play (https://github.com/heroku/heroku-buildpack-play). Its main particularity is that it supports vertical and horizontal scaling.

The following guide explains how to deploy your application on CloudControl.

Weiterlesen »
Last Saturday I was on Coderetreat 2013 in Vienna. There we tried to implement rules of Conway's Game of Life. During the day I've got a lot of experience in TDD, pair programming and languages I haven't used for a while. One thing I've missed was final implementation of game.

One day after the event I've tried some ideas I'd got before. I've pushed my own implementation of game in my Github repository and created an instance of server on Heroku.

Weiterlesen »

RPI: extending swap
09.12.2013 16:46 by Nikolay Kushin

Last weekend I spent some time running my Scala/Play application on Raspberry PI. I got an OutOfMemoryError and had to slightly extend swap space:

 >sudo su  
>echo "CONF_SWAPSIZE=512" > /etc/dphys-swapfile
>dphys-swapfile setup
>dphys-swapfile swapon
Tags: #rpi #scala

playing with scala reflection
06.08.2013 19:58 by

scala is an object-functional programming language, designed to concisely express solutions in an elegant, type-safe and lightweigt manner. scala compiles to java bytecode, so its code runs glueless on the JVM and java libraries can be freely called from scala and vice-versa.

i started using scala about 2 months ago and i’m still impressed so far. simple functionality can be written in a very clean and elegant way and thanks to popular frameworks like play! or lift, the language comes with ‘batteries included’ for web development.

in scala 2.10 the new reflection API was introduced. this API provides the program the ability to inspect and possibly even modify itself at runtime. 

so, let’s see what we can do with it. first of all the API has to be included:

objects and classes can now be instantiated at runtime using an appropriate runtime mirror. by obtaining a mirror from the current classloader, all types and classes are available. invoking the instance of classes and objects differs a little bit, since objects in scala are treated like singleton objects.

so, assuming you already have an object like this:

you can now invoke a method of this object at runtime:

of course, this is just a small example of the power of scala’s new reflection API. it provides a possibility for programs to modify themselves at compile time, and this is done in a very clean and elegant way. this enables a new form of “metaprogramming” in scala. further readings can be found at the official scala docs.