Thursday, January 20, 2011

Loner..

Ask your self this question.

what do you fear the most?(apart from boogeyman or abhiskek bachchan)

answer is ....wait for it...(quoted barney stinson from "how i met your mother")


being lonely....


Friday, November 20, 2009

"Journey"

Recently been doing bit of trekking/outing with friends.
"Enjoying the journey than destinations".

We have been to:
1)Ft.Lohagad
2)Ft.Vasai
3)Mt.Kalsubai(Highest Peak in Maharashtra)
4)Karnala(Bird Sanctuary and Fort)
5)Ajanta(Caves With Famous Paintings and Sculpts)
6)Ellora(Caves With Famous Paintings and Sculpts)
7)Devgiri(Fort of a Tughlaq dynasty)
8)Biwi-ka-Muqbara(Miniature of Taj Mahal)

Labels:

Friday, August 31, 2007

"code of complexity"

Time is a circle.Things that appear not working as of now may work tomorrow and vice versa.

These were the words from a guy ,I met, some time back.

According to him Lucky becomes Unlucky
Like becomes dislike
Black becomes White(No pun intended)

To Conclude this :-

"Stop living in prejudices,'Freeze the Moment'"

Thursday, August 30, 2007

Writing a Simple Struts App..

Step 1: - Copy the struts-blank.war , unzip it in the development directory.
After unzipping you will get following structure
Appname
+WEB-INF
+META-INF
+pages
index.jsp

Step 2: Now we have to define a Action class ,ActionForm class and few jsp pages for the display

ActionForm class:-
package com.StrutsDemo.Example;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
public final class SubmitForm extends ActionForm {
/* Last Name */
private String lastName = "Hansen"; // default value
private String sex;
private String age;

public String getLastName() {
return (this.lastName);
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public void setSex(String sex){
this.sex=sex;
}

public void setAge(String age){
this.age=age;
}

public String getAge(){
return this.age;
}

public String getSex(){
return this.sex;
}

/* Address */

private String address = null;
public String getAddress() {
return (this.address);
}
public void setAddress(String address) {
this.address = address;
}


public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

// Check for mandatory data
ActionErrors errors = new ActionErrors();
if (lastName == null || lastName.equals("")) {
errors.add("Last Name", new ActionMessage("error.lastName"));
}
if (address == null || address.equals("")) {
errors.add("Address", new ActionMessage("error.address"));
}
if (sex == null || sex.equals("")) {
errors.add("Sex", new ActionMessage("error.sex"));
}
if (age == null || age.equals("")) {
errors.add("Age", new ActionMessage("error.age"));
}
return errors;
}
}


Action Class:-

package com.StrutsDemo.Example;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public final class SubmitAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {

SubmitForm f = (SubmitForm) form; // get the form bean
// and take the last name value
String lastName = f.getLastName();
String address = f.getAddress();
String sex = f.getSex();
String age = f.getAge();
// Translate the name to upper case
// and save it in the request object
request.setAttribute("lastName", lastName.toUpperCase());
request.setAttribute("address", address.toUpperCase());
request.setAttribute("age", age.toUpperCase());
request.setAttribute("sex", sex.toUpperCase());
// Forward control to the specified success target
return mapping.findForward("success");
}
}

Jsp page:-











configure struts-config.xml:-













configure web.xml:-













steps for validation:-

Move the application.properties from WEB-INF/src/java/resources/ to WEB-INF/classes/resources/

for checking the validation errors write the following entries in the application.properties

submit.lastName=Enter the Last Name
submit.address=Enter the address
submit.sex=Enter the sex

run the application :
http://localhost:8080/AppName/submit (in this example submit is the action name)

this example was tested with Tomcat 5.09 on Windows 2000

Thursday, May 03, 2007

Mahalaxmi Moment


It was a lazy saturday noon. Pankaj(my cousin brother) and I boarded a train to Mahalaxmi(for Non-mumbaites a suburb in Mumbai). We were planning to go to worli sea-face (u must have got this one.right),we got down at Mahalaxmi station and started walking towards worli (I know its far , but we had time),as we were walking we saw Mahalaxmi race course and decided to barge in, as neither of us had been to race course before. As we were entering through the gates an middle aged man handed me a almanec about horse races. Pankaj and I tried to read it but it didn't make any sense to us.It was kinda difficult to decipher.

We then bought the tickets and went ahead to watch the scheduled race. It was amazing watching these beasts running (reminded me of the movie seabuscuit). After watching a couple of races and the fabulous females there, we decided to continue our journey , in the mean time my cousin got a phone call on his cell phone, and as soon as he answered the phone we were caught off guard by the security personnals of the race course, they snatched the cell phone out of his hands and demanded identifiation and permit to use the mobile phone on the race course.
Later we came to know that we needed permit to use a mobile phone on a race course, as bookies bet on the horses and the bets can be manipulated. And the security personnel thought of us as bookies, and took us to their supervisor.

Supervisor threatned us to lock up in a prison with a case registered against us with the local police. Listening to this my cousin was frightened and hysteric. I on the other hand, put up a fight with the Supervisor and was trying to prove our innocense and ignorance about the rules of the race course. There was this man sitting with the supervisor in completly inebriated state, he saw the copy of almanac in my hand and asked the obvious question(If this is your first time, why are u carrying a almanac?).I tried to explain in all possible ways, I could, to convince him, that it was given to me by a man while we were entring the race course.But he did not buy it.We also suggested them to call the person up from the phone log of last recieved call and confirm, that we were not betting.They said they would investigate it and untill then we go to prison or pay the fine.I got frustrated and started swearing and using the F**K word. My bro got tensed and saw the situation was going from bad to worst.

Pankaj came up with a story of we being students, and we did not have that kind of money. After lot of convincing and drama(he literally begged and cried)to let us go.We were allowed to go out with a warning.

Labels:

Thursday, April 05, 2007

"Fear"

I was just thinking to myself..

It may sound cliche..

But its just a word vomit as they say.

"Fear" really makes you do things, that u wouldn't have done otherwise..

So if I/We know this fact, then I/We shouldn't be frightened or
we should not fall prey for it..

Think it over and let me know.

Tuesday, April 03, 2007

hi'

i m back and blogging.

was bit busy with "uncertainity" and yet "i" am.

cheers