Java

Filter Query Results With Objectify

Reading Time: < 1 minute Objectify is a Java data access API specifically designed for the Google App Engine datastore. It is an easy way to use Google Datastore. In this blog we are going to filter a single attribute for multiple values. Now lets start with creating an entity. The first step is to define your entity class. Here is an example of employee. public class Employee { @Id Continue Reading

Scala LiftWeb: Upload File using AJAX

Reading Time: < 1 minute Liftweb provides AJAX functionality for all html elements except file upload using Scala . But there is a way to upload file using AJAX by binding form as AJAX form . 1) add below lines in your html . <div class="lift:FileSnippet.uploadFile"> Upload File : <input name="upload" type="file"></input> <input type="submit" name="submit" value="Upload"/> </div> 2) class FileSnippet { def uploadFile(form: NodeSeq): NodeSeq = { def handleFile():JsCmd = Continue Reading

Play With Liftweb’s AJAX Generators using Scala

Reading Time: 2 minutes AJAX is an approach for building dynamic web content on the client side . In Liftweb , we can implement this approach either by AJAX or by Comet . Comet is like AJAX , except in opposite direction . AJAX model increases the richness of the User Experience for a single client at a time, Comet can do the same for multiple users. First thing Continue Reading

Communicating with Twitter via Twitter4J using Scala

Reading Time: 2 minutes Twitter4J is a Java library for the Twitter API. With Twitter4J, you can easily integrate your Scala application with the Twitter service. Twitter4J is featuring: – Easy to use with Scala (as it works on any Java Platform version 5 or later) – Support via a single jar file. – Built-in OAuth support. Here is the tutorial to use Twitter4J in Scala. 1. Download the Continue Reading

Getting a preview image of a PDF file in Scala

Reading Time: < 1 minute In order to have an preview image of an PDF file you can use PDFBox. Here is the simple tutorial to extracting an preview image of an PDF file. Firstly you need to get the pdfbox-jar file & you can get it here. 1. You need to have these following imports. import java.io.FileInputStream import javax.imageio.ImageIO import org.dopdf.document.model.PageDetail import org.dopdf.document.read.pdf.PDFDocumentReader import java.io.ByteArrayInputStream import utils.AmazonUpload import java.io.InputStream Continue Reading

Extract a frame image from video in scala

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

Play with Lift’s Autocomplete Widget using Scala-One of the Best Feature of LiftWeb Framework

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

Empower Scala with Apache Solr

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

Annotations in Scala

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

Knolx Session : Built-In Control Structures in Scala

Reading Time: < 1 minute In this session , I will explain about built-in control structures in SCALA . Knolx Session : Built-In Control Structures in Scala from ayushmishra2005

Re Render HTML Template using Scala and Lift

Reading Time: < 1 minute In this section , I will explain how to re-render HTML Template without loading the browser . You can refresh HTML template without loading browser via AJAX using Scala and Ltft . Lift provides SHtml.memoize which memoize the NodeSeq used in apply() and then call applyAgain() in an Ajax call . You can re render a particular template part of HTML page or complete page Continue Reading

Implement Geolocation using Scala and Lift

Reading Time: < 1 minute In this section , I will explain how to implement Geolocation using Scala and Lift . You can easily fetch user’s current location or near by location by his IP address . 1) You will need API key to be able to use . To get API key , just Go to IPInfoDB . 2) Get user’s IP address var ipAddress: String = "" S.containerRequest.map(r Continue Reading