Skip to content

Creating Capped Collections using Ruby – Sample Program

August 18, 2015

require ‘mongo’


client =[ ‘<hostname/ip>:<port>’ ],:database => ‘<databasename>’, :user => ‘<username>’, :password =>'<passwprd>’)

collection_name = {

“COLLECTION1” => 1610612736,
“COLLECTION2” => 1610612736 #SIZE in bytes (Here it is 1.5G)

collection_name.each do |collectionValue|
collectionDetail = client[collectionValue[0], :capped => true, :size =>collectionValue[1]]




Running Scala

February 23, 2015

As mentioned earlier, using the Scala – IDE for running the program. But how we can run it from the command line was the question and using the following steps, one can run their Scala program. Please note, the following sequence needs Scala-IDE! In the following example, i’m casbah for MongoDB!

Following is the package structure of the firstTrial project.


Click on the export in the File menu and following window will be displayed



Use the jar file and set the classpath.

Set classpath=h:\mongo-java-driver-2.13.0.jar;h:\slf4j-api-1.7.10.jar;h:\slf4j-log4j12-1.7.10.jar;h:\log4j-1.2.17.jar;h:\log4j-core-2.1.jar;h:\scala-library-2.11.5.jar;h:\json4s-core_2.11-3.2.11.jar;h:\paranamer-2.5.6.jar;h:\json4s-native_2.11-3.2.11.jar;h:\casbah-commons_2.11-2.8.0.jar;h:\casbah-core_2.11-2.8.0.jar;h:\casbah-gridfs_2.11-2.8.0.jar;h:\casbah-query_2.11-2.8.0.jar;C:\Users\Jagannathan\Downloads\scala-library.jar;C:\Users\Jagannathan\Desktop\firstTrial.jar;%CLASSPATH%;.

Run the program as

Java com.jagan.myscala.package

You will get the output!

Will write more details in the next post.

The roads

February 12, 2015

This is a nostalgic post due to the amount of time which took to phrase it.

Off late, there are several things which are debated on the web.

The basics of being successful in India is difficult as you have to be a successful

  • Son
  • Father
  • Husband
  • Brother
  • Coder
  • Worker and others

According to everyone their perspective is always correct. No one can understand what is the essential part of winning over other’s confidence. India is a country where there are several beliefs. You have your own Religion, Region, State, County and others. Added to these, there are several family beliefs.

So, there is no right or wrong and the action taken during that situation is correct according to that person. Everyone can point fingers, but not taking decision is also a wrong decision. So, please decrypt yourselves 🙂

Empathy – This word is very much needed to be successful for every human being. What is Empathy?

Empathy is the capacity to understand what another person is experiencing from within the other person’s frame of reference, ie, the capacity to place oneself in another’s shoes.

This needs good amount of maturity. This is where an adult differs from a Kid. I can cite so many instances where i had the experience of convincing my kids. Both will be adamant to have an Icecream. They cannot think about us on the aftermath of having an icecream when you have cold.

Follow me and let’s go denotes the same. That is the difference the empathy creates. A single hand cannot create sound.

Recently read a message in facebook and i like it. Team work is not group of people who work together. It is a group of people who trust each other. This is one of the well written statement!

All we are talking about is about our perspectives. There is GenX and GenY. God only know how these cyber-era kids are going to be. The meaning of life is different for them. Let me take an example, most of the people who started working after 2K would have seen a computer during the school final. But in today’s world, they are seeing the computer as soon as they are born!

The situations are going to be different everyday and the business and the perception changes as the day progresses.

If you feel, this is abstract, i wanted to be in this way. Drop a mail to for further debates 🙂

Scala – First Experience

February 12, 2015

Using Eclipse IDE and the details are as follows

Scala IDE build of Eclipse SDK
Build id: 3.0.4-2.11-20140723-2253-Typesafe

Scala Library – 2.11.2

A phenomenal change in the mindset.

The first learning is

  • def defines a method
  • val defines a fixed value (cannot be modified)
  • var defines a variable (can be modified)

Took sometime to understand.

How to read a file and move the contents to a list? (“\n” being the line separator)

val fileContentsList= io.Source.fromFile(“h:/SampleTripFile.txt”).getLines.toList

main method is also there

def main(args: Array[String]) {

Used Casbah (Scala toolkit for MongoDB).

Yes, good learning and enjoying the constructs and the simplicity.

Ruby – Time in Millis

January 31, 2015

The scenario which i encountered is to convert the date from database and convert it to Time in Millis (Example – 1422720326688)

The reason is the third party API which we use forces us to give the time in mills since unix epoch.

Following is the code snippet which can be used. I love Ruby for the expressive nature.

time = “#{rowDistinct[2]}” #- Date from Database – 2014-12-26 10:35:22 format
dTime = DateTime.parse(time)
aTime = dTime.to_time

aTime.to_i # – This will give the result in 1422720326688 format

Happy Rubying 🙂

Two instances of Jenkins – Same machine

January 29, 2015

Using tomcat for war deployment

If two instances of tomcat run, one can see the jobs replicated!

The solution is simple – add the following line in the


The default folder is ~/.jenkins

More on this here

2014 in review

December 31, 2014

The stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

A San Francisco cable car holds 60 people. This blog was viewed about 1,400 times in 2014. If it were a cable car, it would take about 23 trips to carry that many people.

Click here to see the complete report.