Skip to content

Jog Jagan Jog!

February 9, 2014

You might be atleast have a question. Why Jog?

I had been trying to Walking/Jogging(Jolging) for few years from now. But was not successful in all the attempts. But for the last few weeks, the first thing which i do in the morning is Walging. Started with brisk walking and graduated(?) to Jolging. The speed of the Jogging will be little bit better than Brisk Walking.

Some lessons learnt during the last few weeks. In the past i normally get overwhelmed seeing the size/distance of the ground/lap. After few days of walking, started Jolging. I had only one thing in mind when i started this. I mentally made sure that i need to go for few laps, but i never looked beyond few feet.

This gave lot of confidence and within few days did 4-5 laps which translates to 3-4 KMs.

I pray god to give me confidence to continue this activity daily :)

 

2014!

January 1, 2014

Have a fantastic year ahead!

Years come and go, the learning stays with us!!!!

The common thing is we are getting older as we knock of the calendar every year.

 

3 Hungers!

November 8, 2013

Watched the IIMB’s 40th Foundation day Lecture – http://www.iimb.ernet.in/node/3990

Very Interesting points.

  • Hunger for Equality
  • Hunger for Modernity
  • Hunger for Sprituality

No excellence without Equality

Naive people only will have new ideas

Watch it and you will get new perspectives

Save yourself….

May 30, 2013

Having been rewinding the thoughts on this for quiet long time.

 

What are the basic problems which are plaguing the mankind?

The simple reason is, the man’s invention.

The first invention is Money. Think about this. It is unimaginable. Still i remember, the words from my professor on Money during IISc days. Money is the one which works for you even when you sleep. An amazing quote. But what is the problem? We are slowing losing our value / meaning of life going after money

Think of the next generation, they are going to have descent amount of money than what ever we are going to have. But, are they going to have peaceful life?

One more professor once quoted, have we ever hesitated to drink water from the road side tap some 10-20 years back. I have never hesitated, drank water and returned back to play with my friends.

Just turn back now. Are our kids doing that? They are just in the concrete jungles, playing on iPhone/XBOX/PS* etc., I have been observing what kids are playing nowadays. The physical activity is almost zero!

This is a bigger problem which cannot be paraphrased in few pages. Just think about what as an individual we have lost.

We have lost our wonderful environment and getting slow poisoned.

We cannot blame others. The change is ourselves only. The change has to start from us. Normally we think in the following fashion. What is going to happen if i only pollute the nature. But the irony is, everyone thinks in the similar fashion and ending up with a blunder.

I think the recent water problems and other pollution related problems would have left small scars in our mind.

I not going to make any recommendations. It is left to you and you ONLY.

Let’s save EARTH atleast for our new generation (Being Selfish for a common cause)

2 Years….

March 27, 2013
Happy Anniversary!

You registered on WordPress.com 2 years ago!

Thanks for flying with us. Keep up the good blogging!

 

Thanks everyone :)

 

Ubuntu – Lessons – 1

March 20, 2013

Have started using Ubuntu recently and still getting used to the new shortcuts and others.

Since the installation was also done by me, encountered few issues.

Following are the few things which one would encounter and have included the links to save time.

How to install JDK on Ubuntu…

https://help.ubuntu.com/community/Java

wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jdk-6u34-linux-i586.bin
$ chmod u+x jdk-6u34-linux-i586.bin
$ ./jdk-6u34-linux-i586.bin
$ sudo mkdir -p /usr/lib/jvm
$ sudo mv jdk1.6.0_34 /usr/lib/jvm/
$ sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.6.0_34/bin/java” 1
$ sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.6.0_34/bin/javac” 1
$ sudo update-alternatives –install “/usr/lib/mozilla/plugins/libjavaplugin.so” “mozilla-javaplugin.so” “/usr/lib/jvm/jdk1.6.0_34/jre/lib/i386/libnpjp2.so” 1
$ sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/jre1.6.0_34/bin/javaws” 1

    IMPORTANT choose the java you installed as default

$ sudo update-alternatives –config java
$ sudo update-alternatives –config javac
$ sudo update-alternatives –config mozilla-javaplugin.so
$ sudo update-alternatives –config javaws

 

How to enable hibernation

http://askubuntu.com/questions/94754/how-to-enable-hibernation

/etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

How to install MongoDB

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

sudo service mongodb stop

How to solve the VirtualBox Error
sudo /etc/init.d/vboxdrv setup

sudo apt-get install linux-headers-$(uname -r)

Thanks everyone who have contributed to the solutions. Without those, it is not possible for people like me to proceed further.

XML->JSON->HashMap

February 7, 2013

Yes, it is long time since i posted…

Was just trying to see how a XML can be converted to JSON and to HashMap.

The situation is very imaginary.

 

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import net.sf.json.JSON;
import net.sf.json.xml.XMLSerializer;

import org.apache.commons.io.IOUtils;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;

public class XML2JSONConvertor {
public static void main(String[] args) throws Exception {

InputStream is = new FileInputStream(new File(
“e:\\jagannathan\\personal\\java-projects\\secondtest.xml”));
String xml = IOUtils.toString(is);

XMLSerializer xmlSerializer = new XMLSerializer();
JSON json = xmlSerializer.read(xml);

System.out.println(json.toString(2));

printJSON(json.toString(2));

}

public static void printJSON(String jsonString) {
ObjectMapper mapper = new ObjectMapper();

try {

Map<String, Object> jsonInMap = mapper.readValue(jsonString,
new TypeReference<Map<String, Object>>() {
});

List<String> keys = new ArrayList<String>(jsonInMap.keySet());

for (String key : keys) {
System.out.println(key + “: ” + jsonInMap.get(key));
}

} catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

 

Dependencies

<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.0</version>
</dependency>

The Input XML

<?xml version=”1.0″ encoding=”UTF-8″?>
<company>
<name>Jags Inc</name>
<employees>
<employee>
<name>Jagan</name>
<sex>Male</sex>
<dob>24-jul</dob>
</employee>
<employee>
<name>Satya</name>
<sex>Male</sex>
<dob>24-apr</dob>
</employee>
</employees>
</company>

 

The output

7 Feb, 2013 7:20:50 PM net.sf.json.xml.XMLSerializer getType
INFO: Using default type string
{
“name”: “Jags Inc”,
“employees”: [
{
"name": "Jagan",
"sex": "Male",
"dob": "24-jul"
},
{
"name": "Satya",
"sex": "Male",
"dob": "24-apr"
}
]
}
name: Jags Inc
employees: [{name=Jagan, sex=Male, dob=24-jul}, {name=Satya, sex=Male, dob=24-apr}]

 

Follow

Get every new post delivered to your Inbox.