Reading Time: 2 minutes Sometimes it becomes a general requirement to show the preview of a video wherever video gets displayed. Like on YouTube , If you’ll right click on almost any video , you’d find that each video contains a preview image of a frame of that video. Here is a short tutorial for doing the same i.e extracting a frame image from a video in Scala via Continue Reading
Reading Time: 3 minutes Elasticsearch is an open-source, restful, distributed, search engine built on top of apache-lucene. You can read it more on their website. We have an application built in scala with sbt as our build tool. Now we required to have a search capability on the output created by the application. We chose to use elasticsearch for our application. In this post, we will learn to use Continue Reading
Reading Time: 2 minutes The ScalaKnol series attempts to share a nugget of Scala wisdom every few days or sometimes few times a day. Keep tuned. Today we would look at the Uniform Access Principle. The principle states that the client code or the calling code should not be affected by the decision to implement an attribute as a field or a method. Hence essentially irrespective of whether the Continue Reading
Reading Time: 2 minutes Loan Pattern as the name suggests would loan a resource to your function. So if you break out the sentence. It would Create a resource which you can use Loan the resources to the function which would use it This function would be passed by the caller The resource would be destroyed As you would see, the advantages are multifold. First, I am not constrained Continue Reading
Reading Time: < 1 minute For those of us who are coming from an imperative background, we are used to using try catch rather losely. Ok, I am not trying to generalize here but a majority of us do so. When we come to the Scala world, we realise that like other expressions in scala, try-catch-finally would result in a value. The general practice recommended is that finally should be Continue Reading
Reading Time: < 1 minute Object Equality In Scala, means comparing two objects by their values and references.Generally, equality is ubiquitous in programming. It is also more tricky than it looks at first glance. This presentation looks at object equality in detail and gives some recommendations to consider when we design our own equality tests.
Reading Time: 3 minutes Ok, let us get the facts right. We have not provided solution to each exercise but the solutions that we have provided would be good for you to understand the concepts. It would also help you realize how efficiently we can use higher order functions in Scala. The Structure and Interpretation of Computer Programs (http://mitpress.mit.edu/sicp/full-text/book/book.html) is a seminal book which helps you reason and understand Continue Reading
Reading Time: 3 minutes The AutoComplete widget provides a flexible and accessible way to offer suggestions or some kind of filtering information as a user type text information in an input field . If you have used Google , you might see that Google starts providing autocomplete suggestion with entries depending on user’s current input . Lift provides a very easy way to implement Autocomplete using Scala . Here Continue Reading
Reading Time: 3 minutes Solr is ready to use enterprise search server. Here I am going to show you how we can use both of them together to empower your scala application with solr. Solr is able to achieve fast search responses because, instead of searching the text directly, it searches an index instead. This is like retrieving pages in a book related to a keyword by scanning the index Continue Reading
Reading Time: < 1 minute In this session, we will learn about annotations. Firstly, we will see the definition of annotation, standard annotations and then we will learn to write our own annotations. As of now, with Scala we can create compile time annotations (could we create runtime ones without resorting to Java?). For example, if you look at the @tailrec annotation in Scala then it would verify that the Continue Reading
Reading Time: < 1 minute It is quite evident what SOLID principles mean for class typed object oriented languages like Java. However, what do they mean for hybrid languages like Scala which merge the Object oriented and functional approaches. In this KnolX session, we tried to decipher what SOLID principles meant for Scala. Though much of what we know about them can be applied to Scala if we code in Continue Reading
Reading Time: < 1 minute This session was presented at Knoldus knowledge session. In this Session, we’ll learn how Scala’s object-oriented features can be use to make a program more modular. We’ll first show how a simple singleton object can be used as a module, and then we’ll show how traits and classes can be used as abstractions over modules.