Wednesday, April 24, 2013

A trip to Meluha alongside Shiva


I never comment about his attitude or his grin face very ill tempered guy… no one wants to mess with him. He was breathing heavy probably he just battled out someone near our lake’s bank or was he resting after his regular practice. Why does the blood stains are still there in his sword probably he just put few life to end, just before I could ask him to wash them we heard some announcement deep from Manasarowar. Couple of strangers were using some bizarre tools to shout, actually they are inviting us to their town. I wanted to warn of letting strangers inside village but Shiva had other ideas, he was sure they are not part of local barbaric tribes.
May be our ancestors mustn’t have allowed other tribes to fetch water from the holy lake, their thirst was for blood not water. I thought he can discuss about foreigners to him but he was so depressed about next barbaric attack from local tribes. Before dusk another attack we were not able to prevent the murder of kids and women. Ruthless! don’t they know its not fair barbarians! we got some support from foreigners it was all needed for us to trust them. Nandi was the chief of foreigners pack he was looking kind and humble trusting his face Shiva called up for a meeting. We sounded in a single voice to be with his decision :) its was “towards Meluha” we accepted foreigners proposal we don’t wish to die anymore for no reason.
Shiva was sure there would be another attack so he formed the camp in 3 concentric circle, as expected brutal tribes wanted only blood not just water or land. Absolute barbarism lead them to face panicked cattle first which halved their troop and rest were done by our warriors safe guarding our women and children completely protected. We reached Meluha, country of perfect cities :) It was absolutely great decision to move outta our home land to avoid more dead now we’ll be having agricultural land and decent life which we never even dreamt of.
Before we would let to be with their civilization we were to be tested for any disease so we were made to stay in a guest home. We were given separate rooms and precautionary medicines, night I felt ill, feverish I was trying to get up but would not. Crawled out to see if I can get any help from Shiva, he was already in a conversation with Bhadra looks like he is also ill. Shiva ran past me to get help from Ayurvati, chief doctor of the town. Calm and composed medical team entered our block and was treating us with care and comfort. Just then I heard a sound a person falling down, nurse who was taking care of me ran out and I followed her. It was Ayurvati shocked and shivering she is scared to look at Shiva, I stepped ahead to see his throat shinning blue. (contd.)
On a workless friday was dreaming what all I can do on weekend. To wake me up for a lunch my colleague used this bulky book, I glared at him “Lunch” I rejoiced. Only then I noticed the book title “The Immortals of Meluha” it interested me when it had my God of craze in Cover. When inquired I found that its a part of Shiva trilogy series infact the first one, its a common word that I’m often hearing from my friends these days. Long time since a read a good story book besides I would say so far “Sophies world” was only good book have also read book like Death on holy orders and couple of Chetan Bhagats. Then I decided to get that book from him as I don’t have any serious task at hand, after lunch started reading it. Started slowing googling after its information to check if its worth reading then I found “oh! I wasted all time I must have started reading next moment I saw this book”. Read it cover to cover with IPL, dinner, Cricket match all inside took 36 hours frame to complete it… just want to write about it but in different way and tried my hand on it, tell me how it is :D

Sunday, April 7, 2013

How to: Write a file inside webapp directory of Tomcat with Struts2 or JSP & Servlet





Hi! This time its for struts break for database, ever felt you wanna store files temporarly inside your server directory? then this post is to help you out if you are new to java and you have interest in learning, this is good to know! trust me even big folks won’t know this I’m going to tell for Struts2 framework.

============================================

Using ServletContext & ServletActionContext in Struts2

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;

============================================

public String execute() {

try {

String path = “/folder1/file1.txt” ;

System.out.println(“where it might write ”

+ System.getProperty(“user.dir”));

ServletContext context = ServletActionContext.getServletContext(); //Line No.6

path = context.getRealPath(path);

File file = new File(path);

// if file doesnt exists, then create it

if (!file.exists()) {

System.out.println(“trying to creat new file at ” + path);

// Getting parent directory then creating it

File parent = file.getParentFile();

parent.mkdirs();

// Creating file

file.createNewFile();

}


FileWriter fw = new FileWriter(file);

BufferedWriter bw = new BufferedWriter(fw);

bw.write(“This is Written to file”);

System.out.println(“Where it wrote ” + file.getAbsolutePath());

bw.close();

System.out.println(“Done”);

return “success”;

} catch (IOException e) {

e.printStackTrace();

return “input”;

}

}

“String pathname = context.getRealPath(filename);” is the trick here. getRealPath(fielpath) return the exact path corresponding to the server. I said right even experienced folks dont know, cause this is not goot practice :oh!no: if the server is unpacket getRealPath() will return null!! so the best was is to return as String and handle it in JSP or whatever way to can. Anyway Server will be unpacked by default but if something screw up!  Ok TC keep thinking.


For Jsp & Servlet replace line no. 6 with *ServletContext context = this.getServletContext();* Class must extend HttpServlet and init(config) must have the call super.init(config) else context will be null.


Saturday, April 6, 2013

The CAESAR


First sight frightens most, big creepy eyes, kinda weird skin color, strong built. Anyone who comes to my home can’t dare step in unless he accepts them else its gonna be a freak show! Very short tempered yet kind and loving if you are ready to take that one step close to him which either break into complete chaos or builds new relationship. He was very ferocious when I was the only one to raise him till the age of 5 but then my sister took care he became kinda soft, loving idiot playful fool!
Now a days he is addicted to scratch, sometimes shows his mighty teeth to make sure you don’t take your hands of his head or sometimes sweet as “cat’s purr”. He’ll turn 11 this September many sweet moments to count on :) Combai is his breed is not pure though; Combai are ancient breed they are bear hounds used for hunting. Interesting superior in power and intellligence than most talked Indian breed Rajapalayam you can read more about this on Combai-wiki.
He is old now but his attitude is getting better as wine. He has always showed his hunting skills in street fights, along with his mother and brother the trio ruled our avenue in their pink, but now he is alone also age has contributed a lot towards slowing down of fighting skills. But good thing is that he was always listening to strong commands only from me and even death plea of his fellow opponents. Smartest I can say of course he has more of a girl fan base, lived with some 6 to 8 but his first love was Julie, too bad we separated them.
Caesar casually threats
Why sholud I limit to one post? I’ll try to make this a series ;) I always wanted to be a good writer why not use my brother as my fictional super hero, same ordinary life with some sci-fi good idea na… ok keep watching this… I title this post as “My Caesar” but now I’m gonna change it to “The Caesar” a hero in making... #cool rit keep watchin