Play framework

Integrating Scala Code Coverage Tool (SCCT) in Play Scala project

Reading Time: 2 minutes In my last blog i’ve elaborated the steps to integrate the JaCoCo with your Play Scala project. This time we’ll learn about how to integrate the Scala Code Coverage Tool ( SCCT ) in your Play Scala project. Just some easy steps and you’re done with SCCT integration. Lets see it in action. 1. Add the following resolvers in your plugin.sbt file. resolvers += Classpaths.typesafeResolver Continue Reading

Integrating JaCoCo in your Play Scala project

Reading Time: 2 minutes Its always good to have a fine test coverage in any project. I am working on Play framework & this time i’ve tried to integrate the JaCoCo with my play scala project & it’s cool to have it in my project. I am going to elaborate a few easy steps to integrate the JaCoCo in Play Scala project. 1. Add the following lines of code Continue Reading

Getting Longitude & Latitude for a address using Play Framework 2.1 WS API

Reading Time: 2 minutes This blog post serves the two purposes : First , We’ll learn about getting the latitude & longitude for an address using Google Geocoding API. Second , We’ll do the same as mentioned above using Play 2.1 WS API & learn about how to call the web services in Play 2.1. On order to call the other HTTP services within Play 2.1 we use play.api.libs.ws.WS Continue Reading

Efficiently using Session & Flash in Play framework

Reading Time: 2 minutes Play framework is being the love of every Scala developer now a days. In this post we’ll learn about using Session & Flash scopes in Play framework. Play has a stateless architecture so in order to keep the data across multiple HTTP request we can use Session & Flash. Session and Flash data are not stored by the server but are added to each subsequent Continue Reading

Play Framework 2.0: Ajax Calling Using Javascript Routing in Scala

Reading Time: 3 minutes Continuing our series on Play Framework, in this blog we’ll learn How to make Ajax call in play using jsRoutes.We have already covered design forms in Play2.0 using Scala and Mongodb in the past. Play2.0 introduces a powerful feature JavascriptRouter which helps us in making Ajax call.The play router is able to generate JavaScript code to handle routing from JavaScript running client side back to Continue Reading

Play Framework 2.0: Generate TinyUrl With goo.gl API

Reading Time: 2 minutes The Google URL Shortener at goo.gl is a service that takes long URLs and squeezes them into fewer characters to make a link that is easier to share, tweet, or email. Steps to integrate with goo.gl : Step #1 : Register App with Google Register your App with Google through the API Console.  When you create your application, you register it with Google. Google then provides information Continue Reading

Play Framework 2.0: Connectivity with MySQL in Scala

Reading Time: < 1 minute Welcome to another week of KnolX sessions .The emphasis in this session is on How to connect a Play Application with Mysql as database in Scala.Play includes a simple data access layer called Anorm that uses plain SQL to interact with the database and provides an API to parse and transform the resulting datasets. Entire code can be found here: https://github.com/knoldus/FormDemoInPlayWithMysql

Play Framework : Uploading a file to server

Reading Time: < 1 minute In order to upload a file to server we used to use the form with multipart/form-data encoding. File upload is very easy with Play. Use a multipart/form-data encoded request to post files to the server, and then use the java.io.File type to retrieve the file object. Let us see how we can handle the file upload within Play framework. Writing an HTML form: @helper.form(action = Continue Reading

Integrate Github Repo with Travis CI For Scala Play2.0 and MongoDB Project

Reading Time: 2 minutes Travis CI is a hosted, distributed  continuous integration service used to build and test projects hosted at  GitHub for the open source community. It supports building software in numerous languages, including Ruby, JavaScript, Java, Scala, PHP, Haskell and Erlang. A Travis worker comes with a good amount of services you might depend on, including MySQL, PostgreSQL, MongoDB, Redis, CouchDB, RabbitMQ, memcached and others. Hosting your project Continue Reading

Design Forms In Play2.0 using Scala and Mongodb

Reading Time: 2 minutes The play.api.data package contains several helpers to handle HTTP form data submission and validation. In This blog we would learn how to design forms with validations in play2.0 using scala and how to communicate  with database using mongodb. Step 1: Create New Project in play2.0 lets say FormDemoInPlay Step 2: Dependency for Mongodb In Build.scala [sourcecode language=”scala” wraplines=”false” collapse=”false”] "com.novus" %% "salat" % "1.9.1" [/sourcecode] Step 3: Continue Reading

URL shortening with bit.ly in Scala

Reading Time: < 1 minute Short URL’s are becoming the need of most of the application. We’ve used the bit.ly for the URL shortening in our application. Just a little bit work to do for achieving the URL shortening with bit.ly. Here are the steps to do that : You should have the following credentials in order to call the bit.ly API. i. apiKey : You’d get it on registering Continue Reading