Java Performance Tip

Consider the case in which >, == and >= operator are used for comparison.

long starttime = System.currentTimeMillis();
for (int i = 0; i < 8888888; i++) {
if (i == 10 || i < 10) {

System.out.println(“Total time taken case1″+(System.currentTimeMillis()-starttime));

starttime = System.currentTimeMillis();
for (int i = 0; i < 8888888; i++) {
if (i <= 10) {

System.out.println(“Total time taken case2″+(System.currentTimeMillis()-starttime));

Output is :
Total time taken case1 31ms
Total time taken case2 16ms

I guess not many people fall for 1st case but still i have seen code implemented using case 1.
Just a cautionary Tip.

When Google Latitude Stalking Isn’t Such A Bad Thing

Yesterday, Silicon Valley’s local CBS affiliate ran a story (video here) about a woman getting her purse snatched. But what’s interesting is the way she got it back: With an assist from Google Latitude.

You see, in her purse, her phone had Google’s location-based social networking service installed, and it was updating the location of her phone in real-time. So even though the thief hopped in a car, when the girl called her sister, she was able to tell police exactly where the criminal was. They arrested the man and got the girl’s purse back.

It’s worth noting that the woman said she had the service running on her phone “as a joke,” so that she and her sisters could “stalk each other.” And that’s interesting because ever since it launched a few months ago, jokes have abound about it being a tool for stalking. But at the same time, the program had a user base of over a million users just one week after it launched. People are clearly interested in using location data in social services, but it’s usually only negative connotations that are associated with stories about it. Here’s a positive one, but it still has some negative undertones.

After all, if the girl’s sister knew exactly where the phone was, that means Google did too. Of course, Google has a policy not to share that information, but if push came to shove, and the authorities got the right warrant, Google would have to give up such information. Hopefully, you’re not a criminal — and if you are, hopefully you’re smart enough not to use Google Latitude — but it’s still a bit creepy for most people to know that a company has data about where they are at all times. And Google is hardly the only one of these services, everything from Loopt to Whrrl to Brightkite all have varying degrees of information as to your whereabouts if you use them.

Location-based services have yet to take off on a large scale, but with Google now in the field, and major players like Facebook and MySpace undoubtedly looking at entering it, it’s only a matter of time. And when those huge social networks get into the game, there will be some initial backlash, but then people will start using it. (It may even complement other future lost purse stories.) And slowly, users will let the privacy ramifications fade into the background unless some sort of location-based horror story makes headlines.

I, for one, welcome a future with ubiquitous location services in the social layer. Because there are upsides to location as well. This purse snatching incident is a bit extreme, but using location to find friends close by on a service like FourSquare, which I’ve been using for several weeks now, also speaks well to its potential.

Article taken from Googl Latitude is nt such a bad thing

Fraud hit Company ‘Satyam’ goes to TechMahindra

Tech Mahindra wins Satyam bid; Gets 31% stake for Rs. 1757 crore
Tech Mahindra Ltd., wins the bid for Satyam Computer Services Ltd(fourth largest Indian software services company). Tech Mahindra bid at Rs 58/share while L&T bid at Rs 49.50/share, states Dow Jones on CNBC TV18. Tech Mahindra wins bid for Satyam and three months of drama comes to an end for Satyam. Tech Mahindra to pay Rs 1757 crore for 31% at Rs 58/share. Tech Mahindra stocks surged today in the morning to 24% and is now trading at Rs 369, up 15% on the BSE. Experts feel the Satyam board deserves a pat for resolving the issue within 3 months.

Satyam Computer Services Ltd., surged yesterday to 14 per cent in the Mumbai trading as both Larsen & Toubro Ltd. and Tech Mahindra Ltd. vie for control. They competed with bids for achieving a controlling stake in the company which is amidst fraud inquiry. While Larsen & Toubro Ltd., played at Rs. 49.50 per share, Tech Mahindra Ltd won it at Rs. 58 per share.

Climbing north to 14 percent to 53.80 rupees just sometime back as of 10 a.m. yesterday morning; the outcome of the bidding is that Tech Mahindra won the stake in the company.

It means Tech Mahindra Ltd., will now get control over Satyam’s 50,000 employees that and also a chance to increase its domain expertise breadth from Telecom to clients like Nestle, GM, Nissan. Tech Mahindra Ltd. is a company that is partly owned by BT Group PLC.


It is not easy to describe what The Ultimate Search Engine Loophole is because the concept is so very innovative and different. At best, it is a method to bring websites to the top of search engine rankings by exploiting a loophole that is present in them, especially in MSN.

The product has been designed by Chris Rempel ( and Dave Kelley ( in joint collaboration. Chris Rempel is famous for his previous product The Conduit Method also, and Dave Kelley is known for Linkvana.

Benefits of The Ultimate Search Engine Loophole
The Ultimate Search Engine Loophole taps a defect in the search engine algorithms in order to bring websites to the top of the rankings.
It is specially designed for the MSN search engine.
The method does not do anything illegal. It is completely white hat.
There are various things that The Ultimate Search Engine Loophole contains. This product has an eBook, an automating software applications, blogs (for which the program shows how to generate content), links to several websites and a particular kind of web hosting that can target some special IP addresses for the website that can improve its ranking.
The method described in this product is a long lasting method. It will not give just a temporary spurt to your website rankings, but they will stay there for a long time.
The search engine rankings are improved through any keyword that the author chooses.
The improvement in the search engines using this technique becomes apparent within a short time, as short as 5 days.
What’s Unique about The Ultimate Search Engine Loophole?
Everything about The Ultimate Search Engine Loophole is unique because it is a never-before concept. It is a guaranteed technique to bring your website to the top of MSN, even as the first result. Though MSN pales in comparison with Google, it is still used by a significant number of users, which makes this technique valuable.

The best thing about The Ultimate Search Engine Loophole is that it is perfectly legal. You are not tweaking the system in any way; you are only making use of a defect in MSN’s own system. This cannot be considered illegal by any counts.

Also, the method puts a paid to keyword based SEO. Any keyword can be used by marketers – there is also a list of noncompetitive impossible keywords present on the website – which marketers can use in order to boost their search engine rankings on MSN.

Other Features
The price of The Ultimate Search Engine Loophole is a bit steep at $67 considering that it works only for MSN, but even then it is worth considering because a significant number of people from over the world use MSN as their primary search engine. However, this is a onetime payment to use this technique for life, for any number of websites. There are no recurring payments to be made. Payment is accepted through Clickbank. Any credit card is applicable.

How to create a new file from existing file using grep command in unix.

Consider i have a file named as main.log having following contents:
Today is Monday
Today is Monday
Today is Tuesday
Today is Monday
Today is Wednesday
Today is Monday
Today is Thursday

And now i want to make a new file which contains line having “Monday” .
Command is :
grep “Monday” main.log > monday.log

Now if in case you want to append to the same file then:
grep “Monday” main.log >> monday.log

The single > is used to create a new file and >> is used to append the existing file.