Insights and perspectives to keep you updated.

How to Implement Cross Cutting Concern using AOP in Scala

Reading Time: < 1 minute In this blog, I have explained that how easily we can implement Cross Cutting Concern such as logging using Aspect Oriented Programming in Scala. These concerns have nothing to do with core business logic. Aspect Oriented Programming is used for encapsulating cross-cutting concerns into re-usable modules. Here we used AspectJ weaver to weave precompiled aspects into project output First we defined an annotation style aspect Continue Reading

Spray authenticate directive : A decoupled way to authenticate your API

Reading Time: 3 minutes Organization exposes critical business data or user’s private data through API. It is required to protect API against any unauthorized access, attack or security breach. In this blog I am not going to discuss API security mechanism. Here I want to detailed out the separation of API authentication from underlying RESTful Api. Authentication / Authorization is cross cutting concern and it must be decoupled from Continue Reading

How To Implement logRequestResponse in Spray

Reading Time: < 1 minute Spray has the feature to log request and response of every route through logRequestResponse. We needn’t to add log in each route because it could be done from a single place. This also helps to maintain clean code. Please see below example:- class HubServices extends Actor with HubRoutes { def actorRefFactory: ActorContext = context // logs just the request method and response status at info Continue Reading

Configure TURN server for webRTC with Firefox

Reading Time: < 1 minute Initially, I was using turn server for webRTC in my application only with Chrome but later i got the requirement of using turn server with Firefox as well. I tried to run my application on Firefox with the same code as for Chrome,but i was getting the below error : uncaught exception: buildPeerConnection failed, call not completed Actually, as i mentioned in my previous blog Continue Reading

FunHop: Working with Exceptions in Scala – Problem Statement

Reading Time: 2 minutes If you look at the earlier posts in the FunHop series, you would notice that Exceptions are side effects. Exceptions by their very nature also break referential transparency and are context dependent. You would have got an idea about referential transparency from our earlier post. If not, it might be a good idea to review it once. Let us consider the code sequence below def Continue Reading

Scala in Business | Knoldus Christmas Newsletter – December 2014

Reading Time: < 1 minute Hello Folks We are back again with December 2014, Newsletter. Here is this Scala in Business | Knoldus Newsletter – December 2014 In this news letter, you will see that how fast organisations are adopting Typesafe Reactive Platform to get best solution, how functional programming is getting into mainstream and how functional programming is becoming popular choice among the developers. So, if you haven’t subscribed Continue Reading

Continuous Integration : Integrating BuildKite with Your Scala Project

Reading Time: 3 minutes In a very broad sense, BuildKite (earlier called BuildBox) is a continuous integration server that allows you to keep working on your code while there is a CI box which is reporting about any issues. The problem with most web based CI servers is that they have to do a lot of magic beneath the hood to let you build your custom system on their Continue Reading

SCALA : Handling visibility of constructor fields

Reading Time: < 1 minute Constructor fields are parameters of class . In scala , we can define the visibility of parameters , visibility of parameters can be defined by “val” or “var” or without “val” or “var” . For example : class Knoldus(val name:String) Here, “val” defines the visibility of constructor field. With val field scala> class Knoldus(val name:String) defined class Knoldus scala> val knolObj=new Knoldus("Malti Yadav") knolObj: Knoldus Continue Reading

Scala in Business | Knoldus Newsletter – November 2014

Reading Time: < 1 minute Hello Folks We are back again with November 2014, Newsletter. Here is this Scala in Business | Knoldus Newsletter – November 2014 In this newsletter, you will get to know the popularity of Spark in big data. Spark is getting more attention in all over the world for fast data processing. People are getting much faster data processing speed with Spark. You will get to Continue Reading

Building Reactive applications with Akka

Reading Time: < 1 minute Knoldus organized a Meetp up on Wednesday, 29 Oct 2014 at 5:00PM. Mr. Nilanjan Raychaudhuri from Typesafe presented this session on “Building Reactive applications with Akka”. He did the session remotely from Germany and it was very well accepted by the audience at the meetup. Nilanjan is a consultant/trainer and member of Play framework team. He works for Typesafe. He has more than 14 years Continue Reading

Easiest Way To Map Optional Nested Case Class with Slick in Scala

Reading Time: 2 minutes Few days ago, I had a scenario, in which I was supposed to map optional nested case class in slick using Scala. case class Employee(emdId:String,name: String, record: Option[Record]) case class Record(subject: String, mark: Int) I was trying to do this mapping the way, I have explained below. class EmployeeSlickMapping(tag: Tag) extends Table[Employee](tag, “Employee”) { def emdId = column[String](“emdId”) def name = column[String](“name”) def subject = Continue Reading