Friday, June 19, 2009

Date to String & viceversa

Yet another simple utility:: date to string and string to date conversion.

Date to String:
            SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss");
            format.setLenient(false); //if the string is not inthe expected format:: throws Exception.
            Date date = (Date)o;
            return format.format(date);

String to Date
            if(str ==null )
                return null;
            SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss");
            format.setLenient(false);
            Date d = format.parse(str);
            return d;





Thursday, June 18, 2009

James Bond 000 :)

Once Jamesbond went to a forest for hunting and on his way he sees a Dog.
James Bond: I am bond, James Bond
Then the dog responded: I am dog, Mad Dog... bit him and left.


Monday, June 15, 2009

No Wrap

This is another simple, yet eats off time and forces us to use TDs to allign text + few elements in a td in one horizontal line. The fix is :

<td style="white-space: nowrap;" >  and <s:textfield theme="simple"
                    maxlength="4" size="4" name="playerAccAgeValue2" /></td>

This one worked for me. Another proposed soln:


<td>
 <nobr> 
<asp:Button ID="Button1" runat="server" Text="Add" />
<asp:Button ID="Button2" runat="server" Text="Delete" />
 </nobr> 
</td>
This stops the text from being wrapped around the textbox. Hope it helps.

Friday, June 12, 2009

Bond... James Bond + Telugu guy :D

On a flight James bond was sitting next to a Telugu guy.

Telugu Guy: "Hello, May I know your name please?"

James Bond: "My name is Bond" Continuing in his inimitable style,

"Bond .. James Bond"

Then Bond asks: "And you?"

Telugu Guy: " My name is Rao...

Siva Rao...

Samba Siva Rao...

Venkata Samba Siva Rao...

Yarlagadda Venkata Samba Siva Rao.....

Rajasekhara Yarlagadda Venkata Samba Siva Rao...

Sitaramanjaneyula Rajasekhara Yarlagadda Venkata Samba Siva Rao...

Vijayawada Sitaramanjaneyula Rajasekhara Yarlagadda Venkata Samba Siva

Rao... .."

Since then when anyone asks Bond his name he simply says

"James Bond"

Tuesday, June 2, 2009

running a Main file located in a jar

This is the frequent problem that i am getting so i thought i will put it here so that it can help somone looking for it.

1. I have a jar file in which i have a class file holding public static void main
2. The execution should also pickup a properties file.

Command:
java -cp jar_having_main_class.jar;some.properties;       com.comp.root.TheMainClass

Every time i get this problem i am re-googling forit. so thought i will post it here.

Monday, June 1, 2009

Q

Seen the below on a forum:

Don't argue with idiots. They bring you down to their level, and then beat you with experience

Wednesday, May 27, 2009

Q

A Lawyer will do anything to win a case, sometimes he will even tell the truth. - Patrick Murray

SRK defends Knight riders

SRK supports his team: I see he is getting himself adjusted to the failures.

He returned to vote, now he’s shooting for Karan Johar, getting kids Aryan and Suhana ready for school, while watching his IPL team Knight Riders take a beating in South Africa over television like you and me.

Tuesday night, it was like that again, with the Bollywood Badshah’s knights losing poorly to Delhi in Durban and thereby becoming the first of the eight teams to bite the dust in the race to the semis. Shah Rukh, however, was not in mourning. “What can I say,” he laughed, “we’ve had a string of losses, but we haven’t lost motivation, what we’ve got to do is see where we take the team from here. Some of the matches were close and almost broke our hearts. But the others were complete losses. We had nothing to prove. So I told the boys, go out and have fun!”

He’s aware that the Knight Riders, despite being written off as the worst-performing team in the IPL, is the most valued brand of the T20 tournament. The Economic Times pegged its brand value at $42.1 million, followed closely by Mumbai Indians at $41.6 million and Team Rajasthan at $39.5 million. “Personally, that doesn’t make me happy,” Shah Rukh regretted. “What is a brand? I, as an actor, am a brand... and that puts pressure on myself to perform better and make sure my films do well. Brand is all about giving quality content.

Our cricket content has to improve if it is to be deserving of the top brand spot. That didn’t happen last year. So we tried harder. It didn’t happen this year. Now we need to build the brand up again from scratch on content... rather than other social aspects. I’m happy, of course, that the business is doing well, we have the maximum sponsors and are making money. But the money needs to be put where the product is.”

The team’s hopes have perished this IPL as well, but he isn’t ready to look at the next season as yet. “I believe when you’re down, you shouldn’t take decisions; and when you’re up, you shouldn’t either. Just step back and relook at the situation. That’s what I’m doing,” said the actor. Did his absence in South Africa affect the morale of the team? “Not really,” replied Shah Rukh. “I had decided at the start to be with them for 15 days. The boys are depressed, they can’t do more, and my being around only makes it worse for them. My presence in the dressing room makes them break down. I’m fond of all of them and they like me. But my goodness comes in the way of losses. The defeat gets highlighted because I own the team. They feel worse because they think Shah Rukh Khan has been let down and is hurt... though I don’t show it. Whereas when I’m away, they’re able to go out and play cricket normally.”

Does he have a Chak De! message for his disheartened team? “They are all professional players, they play cricket the whole year, and win or lose... they just get on with the next game. I can’t tell them how to play. But I hang around them. Some players are cynical in defeat. Others raring to go. I meet the two up, sit and chat with them, tell them not to be disturbed. We have lost as a team, we don’t have what it takes to win, and we can’t go on depending on hope. I really can’t find fault with anyone. The idea is we go up and come down together. If I jump up and cheer when somebody hits a six then I must also be prepared to go down with them when they fail. The important thing in sports is that it teaches you how to lose, but not to become a loser. Sports always gives you the chance to come back. It’s a great leveller. The whole success in my life is because I think like a sportsman. There’s always another chance. But I wish I didn’t have to learn this lesson so fast!”

Q

i pickedup the below froma forum:

Friendship is like peeing on yourself: everyone can see it, but only you get the warm feeling that it brings.

Hope this puts a smile on your face. Remember, don't take life seriously, nobody gets out alive.