Skip to main content

Posts

Software Developer Interviews

I thought to write this about the experience gathered when interviewing people, actually developers with java experience. More people comes with vast of experience in software development, armed with programming languages, tools and frameworks but the problem is that they really don’t know what they suppose to know. Some CVS are dozens of pages, multiple experience levels in several companies, but ultimately failed and so disappointment. First read what are you applying for, read the vacancy details thoroughly and try to understand whether you are eligible to apply to the job. Then you can apply, if you come to an interview be prepared, if you are not prepared and suppose you have been asked to be present at an interview within short time period, I say if you are not prepared ask for more time. Normally almost all companies fulfill your request for sure, that is a simple thing in an interview process. Also be careful when adding contents to your CV because all the details in the CV...
Recent posts

Using MongoDB Scala $nin

Hi guys, Today I needed to execute a query to filter some records. Lets say I have a Product Collection(Tables are called Collection in MongoDB) and I have following two fields in my product collection for simplicity. Product ---------------- Id sku (store keeping unit) I retrieve data from collection like this. var products = models.Product.find(MongoDBObject("title" -> "atitle") ) .skip(0).limit(10).toList I have filtered data by 'title' already and I have I want 10 records from 0 by specifying skip and limit. Now I have another list ('sku' list) that is list contains sku values. I want to retrieve Product list from DB that is not in SKU list. To do this I have used $nin which is a query operator of MongoDB. var products = models.Product.find( {"sku" $nin descendents}, {MongoDBObject("title" -> "atitle")} ) .skip(offest).limit(10).toList more...

How to save Large html(data) content with Play framewrok, MongoDB and Scala

Hi all, While I was working on a project I had to save large content of data from text area filed in a form. I'm using Play Framework 2.0.2 as a web framework and using scala html templates as views. I have text area filed in my form to add html data (Actually here I'm using ace.js   that is high quality code editor. Ill give brief introduction to ace later). Ok Here I do not post form binding with model class but just think that there is a simple model class lets say Page. Most important thing is the saving part of this program. Here I have posted my save definition(function). def save = Action(parse.urlFormEncoded(maxLength = 1024 * 1000))  { implicit request =           //More code goes here.. I have not posted           Page.save(pageForm)           Redirect(Pages.show(        ...

Upload CSV file using opencsv with Play 2.0.2, Scala and MongoDB

Hi Everyone... Today I'm going to explain you that how we could upload a CSV file with list of products to the MongoDB table. The way I'm describing here might me inefficient but still it is useful. We know that Scala is running on JVM and so that we can use any java library with Scala . I will use OpenCSV as a CSV parser for this program. OpenCSV is a CSV parser library for Java. No matter it is for java here we will use it with Scala. First we should have MongoDB up and running. Include following opencsv dependency in your build file. I'm using SBT as building tool. "net.sf.opencsv" % "opencsv" % "2.1" Here next I will create view file. Name of this file will be 'index.scala.html'. @(message: String)(implicit request: RequestHeader, flash:Flash, l: Lang=Lang("en")) @import play.api.i18n._ @import views.html.helper._ @main(message, null) { //print messages @if(flash.data.contains("message")){ ...

CSV Parsing with Scala

Good new about Scala is, actually not only about Scala but all other JVM based languages is that they can take advantages of Java libraries. Since the Scala is a JVM based programming language its easy to use Java libraries and classes with it. I needed to parse complex CSV file with Scala and create MongoDB object to represent an each row of the CSV file. This would have been easy if I was asked to create MongoDB objects using a JSON file because the JSON is highly supported by the MongoDB. But here I only got complex CSV file with loads of data. First I found some good tutorial about Scala CSV parsing and started my work. Yes I'm using Play framework 2.0.2 with Scala and MongoDB. I found opencsv is the best solution for parsing CSV files with Scala. Opencsv is for Java but as we already know that Scala is a JVM based language we can go with it. First I updated my build configuration file to reflect the application dependencies for opencsv. add this dependencies to your ...

SCALA A Scalable Language...

Scala is called scalable programming language built on the top of Java Virtual Machine. This is good for writing small programming scripts and also complex software systems. Scala runs on the standard Java platform and we can use most of the all Java libraries. Scala Is a combinations of Functional programming language and Object Oriented Language. Scala is easy to use because its simple. Sometimes this simplicity might seems to be as complex. Everything depends on the way of you are looking at it so if you are are a Java programmer it might be easy to use Scala without putting huge effort. Ofcourse Scala is better start as a first programming language. I still love programming in Java but now Im working on a Scala project which is using latest technology stack. Im still new to discuss about Scala but I experienced that the Scala is a really scalable and functional language. Ill here introduce a associative map of Scala language. Semicolons are not needed in Scala and with this...

How to get form value in scala html file in play 2.0.2

Its really easy to get form value in scala html file (in view). First take a look at how form is defined in the controller. I have only added related code snippet. mapping( "courseId" -> nonEmptyText, "name" -> nonEmptyText) Now look at my scala.html file. Following code will accept the course form as a parameter. @(courseForm: Form[Course])(implicit request: RequestHeader, flash: Flash) Now you want to access the 'courseId' in courseForm. First I print the value like this. @courseForm("courseId") But this will not work because it prints list of values because it is reference to the Filed object itself not to the real Id value. Now I do like this. @courseForm("courseId").value This will print the real Id value. (@ is to print something in scala html file)