Friday, January 30, 2009

jQuery - Prevent default hyperlink behaviour when the click event calls user defined function

This may be obvious to many, but I am stupid, so it took me a while to figure this out.

When we bind a click behavior like this:
$("#temp").click( function(){ onClick("hello"); } );
and you want to prevent default behaviour of the click using preventDefault() you have to do:
$("#temp").click( function(e){ onClick("hello"); e.preventDefault(); } );


Wednesday, March 12, 2008

IPL

I was in india during the first IPL auction. I guess staying in the US, we cannot really capture the excitement behind it. We get a true sense of it when we watch the news channels in India. Anyways, I hope IPL takes off. I remember discussing this with a few friends a couple of years back. Its amazing why it took so long to mimic the idea of EPL, NFL or the NBA.

Though the IPL "draft" feels like vegetable market right now, it will hopefully settle down into a more professional structure later on. Much will depend on the how much the locales are willing to go to the stadium to watch the matches and buy the merchandise to support their team. BCCI needs to make tickets really cheap to make the stadiums full. I guess media will also play an important part. I hope they can blow up the coverage as much as they did during the auction when movie stars were involved.

On lighter note, I don't like the Kolkata "Knight Riders" name. Hopefully Deccan cronicle (hyd team owner) won't name the team "Hyderabad chronicles". Click here for the Hyderabad IPL team. Gilcrist, Symonds(if they play?!?) and Afridi. Ok, enough batting. But hyderabad is pretty weak in the bowling department.

Friday, January 11, 2008

How to ignore hover in IE 7?

Okay, here is a very "unlike me" entry.

Its something to do with Cascading style sheets(CSS). If you don't know what it is, you can safely stop reading right here. If you care less you can also stop reading.

The only reason I am actually writing about this is that i did not find a single article describing the need for this.

PROBLEM:
I had a huge 3 level menu(suckerfish/tanny style). It took almost 2-3 seconds for the hover to activate my sub level menus in IE 7.

ANALYSIS:
The 'hover' implementation in IE 7 totally sucks once page size gets large(mine is 50k, without images). May be it was because I had like 200 li's in the menu :). No its not ridiculous. Amazons' left nav has almost a hundred. And its only 2 levels.

Anyway, the delay was totally unacceptable.

In the current implementation IE 6 uses javascript and ignores hover because it does not understand it. IE 7 however picks up the hover and uses it, messing up my nav.

I cannot use conditional comments for NON-IE browsers, so I had to find some hack so that IE 7 will ignore hover and use the javascript meant for IE 6.
In IE 6 we had a lot of choices. But since IE 7 was closer to CSS standards it became more annoying to hack it. It took me a lot of time but eventually found a fix here.

SOLUTION:
1.Put a lang attribute in the body tag like this:
<body lang="en"> . . . </body>

2.Prefix *:lang(en) in front stuff you want to ignore(You might recognise the follwing CSS from suckerfish)

#nav li:hover ul ul, #nav li:hover ul ul ul {
left: -999em;
}
#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul {
left: auto;
}
#nav li:hover {
color : #FFFFFF;
background-color : #2D76AB;
}

making them

*:lang(en) #nav li:hover ul ul, #nav li:hover ul ul ul {
left: -999em;
}
*:lang(en) #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul {
left: auto;
}
*:lang(en) #nav li:hover {
color : #FFFFFF;
background-color : #2D76AB;
}

IE 7 will ignore these hover definitions, other browsers will pick them up.

3. Dont forget to change your conditional comments to:

<!--[if IE]><script type="text/javascript" src="js/iehover-fix.js"></script><![endif]-->

Note:I am not an expert in CSS. There might be a more obvious way. But i didn't find it. This works for me just fine.

Saturday, December 15, 2007

Las Vegas

Couple of my friends are getting married in feb so we decided to head to Las Vegas. It wasn't entirely as I pictured it. I figured it would more classy like I saw in the ocean's series(11,12,13), but it was still good enough. Lots lights, lots good looking people, and million ways to loose your money.


Map from here

Stayed in Planet Hollywood(formerly Alladin). It was a 3 start hotel right on the strip so it was a pretty good spot. It wasn't as pricey as the others. It came up to $600 for 3 night. Four of us had 2 queens so it was good enough. We had a dress worn by "Elizabeth Berkley" from showgirls showcased in our room. Nice :)

Day 1:
12 PM: Went to Paris buffet in Paris hotel($15).
1 PM: Gambled - Black jack and Roulette - Won $140, quit while I was ahead.
2 PM: Walked a lot
4 PM: I think we checked out treasure island, we wanted to see the free "Pirate show". Show was closed until Dec 25th 2007 :(
5 PM: Tried to see the free Volcano show at mirage - was closed on day because of wind. :(
6 PM: Stratosphere - $10 to get to the top - Nice view of vegas as the lights came on. Got on a ride called "Insanity". I must be insane. I will not get on it again.
7 PM: On the way back to hotel, we check out the water show right in front of the Bellagio. Happens every 15-30 minutes in the evenings. It was OK. It just a 3-4 minute show.
9PM: Freshened up and hit the street.
10PM: Went to a show called "Crazy horse"($60) in MGM. My blog is PG so i wont get into the details. Email me if you want more details :)
12AM: You know what we did after that.

Day 2:
12 PM: Buffet at Gandhi restaurant($15). Took cab. Decent food. But nothing to die for, so don't go.
2 PM: Check out New York, New York hotel. Gambled, lost a LOT.
5 PM: Saw a basked ball game in a pub.
6 PM: Came back and freshened up.
9 PM:. Went to Ceasars and Bellagio and gambled again, hehe.
12 AM: You know what we did.

Day 3 : My flight was at night
1. We gave our bags to the bell boys in out hotel. They tag them and give us a receipt so we can collect it any time.( Just give them a tip )
2. Buffet at Spice market($20) in Planet Hollywood. Loved it. One of the best buffets I've been to. If you stayed there take a receipt from the hotel. You will get a discount.
3. Checked out Planet Hollywood and Ballys. I stuck to black jack on the machines so I wont loose much. I actually won, only $10. Its not as thrilling as loosing a 100 dollars.

FOR THE FIRST TIMER - TIPS:
1. Take up to %500 in cash even before you fly. YOU WILL NOT FIND YOUR BANK ATM's THERE. Every ATM charges 3-5 dollars per transaction.
2. Keep a lot of $1 bills. Atleast 10. You will have to tip a lot of people.
3. Once you get your chips at a table in a casino, exchange a $5 chip for five $1 chips so that you can tip the waitress or the person hosting your table.

Check pics here

Thursday, September 06, 2007

US OPEN 2007

Apart from the India vs Zimbabwe cricket match I went to 5 years back, the US Open was the biggest sports event I ever went to. I did not see any top of the line players but I did see all of the Indian representation at the open. Sat mostly in the Grand stand. Though it was a small stadium compared to Aurthur Ashe or the Louis Arm Strong, I got to sit really close to the action.

Here are some of the clips I recorded:
SANIA MIRZA VIDEO
Observation: Sania Mirza can hit an amazingly hard forehand(Not in Video).

LEANDER PAES VIDEO
Observation: Leander Paes was just too good that day. Also, he was looking constantly at somebody in the reserved section. Wonder who it was.... Girl Friend? Coach? Dad? Mom? Kid? (Look carefully at end of the second video below, he was constantly looking towards that direction). I Hope he answers my question when he reads my blog.

MAHESH BHUPATI VIDEO
Observation: Mahesh Bhupathi had a weak serve for somebody so tall.

To see more pics of open and my Labor day weekend click here.

Thursday, August 02, 2007

Gears of War

I finally bought a XBOX 360 and managed to finish Gears of War after a million tries in casual mode. I was never really 'away' from games but then again the last few games I played were the PC versions of Call of Duty Demo and Unreal tournament, hehe.

Anyways, Gears of War was awesome. Now I understand what the buzz was really about. However, I keep getting scared while I am playing the game, is that really normal?
Click HERE for a really good trailer.

You are basically this Guy(Marcus Fenix):


You have to kill this guy(General RAAM) in the end.


This is a nice pic of the gun you can carry around:

Friday, May 25, 2007

Pirate of the Caribbean III

Pirate of the Caribbean III tied up loose ends from part II, but it was waaay too complex. My suggestion is stop thinking and complaining and just watch it. Sometimes, the movie felt as if it was trying to cater to kids, but the high points make up for them i guess.
Wait till after the credits, unless you want to go the restroom, there is a small unimportant scene...
RATING: 5/5 (Weird... the 1,2,3,4 keys on my keyboard were not working)

Sunday, December 10, 2006

Videos

These were posted on Digg.com
Watch this a couple of times, its scary...Here
Me want this...Here

Monday, November 27, 2006

Open Letter to the Cricket "Fans"

I am writing this with a fit of rage. What the f**k is wrong with the indian cricket fans?
What is this Ganguly vs Dravid already? The whole cricket world must be laughing at us. Its like a circus. Its like a family quarrel.
Here's my message to the those people:
You guys are lame. Fans dont demoralize their team. Fans love their team unconditionally. What you are calling passion, is nothing but a lame excuse to get your lame frustration out. If you think you can make difference you should have played cricket, gotten yourself into the team instead of getting the degree your dad told you to get and enroll yourself up for the no-win/no- loss job life. How about I watch you going to office on TV everyday and one fine when I get dissapointed on your performance I call for your HEAD!
If your so frustrated with the losses STOP WATCHING OR FOLLOWING CRICKET.
I love this team no matter what. I love it when they win, I hope they play better when they loose.
SHAME ON YOU!!

Wednesday, November 08, 2006

Is this true?(Nerd alert)

People who read Digg.com might have read this already.
I approve of this article 81.65%.:)
Nine Things Developers Want More Than Money

Saturday, July 08, 2006

Pirate of the Caribbean II

Johnny Depp is GOD!!! Once again he was amazing in the movie. The movie on the whole was alright. The bad guys were a bit gross to look at. I guess we'll have to see Part III to really appreciate it. No spoilers in this post so go ahead and watch it. If you don't like it, I'm sorry for your taste in movies.
RATING: 5/5

Tuesday, May 16, 2006

Last 10 Non-Tech/Non-Career things I Googled

1.Champagne - Just curiosity after I drank a $5 bottle
2.Sukiyaki - Japanese song on TV, read name of song from subtitles
3.Subtitles - Wanted to know how subtitles are generated
4.Glycogen - Some connection with cardio
5.Hyderabadi Biryani - Wanted to cook it, but didn't
6.Ileana - Apparently not much info on her....yet
7.Sunil Ravulapalli - Hehe, proud of the second link google found
8.Daniel Craig - Next James Bond
9.Greek Cross - While playing the Da Vinci challenge on google
10.Eternal City - Same as above, I think it's Rome

Pokiri

Mahesh Babu was good, Ileana was HOT, the item girl was HOOOOOTTTTT!!!! That summed up the movie for me. The movie had excellent songs and a couple of comedy scenes were a riot. Other than that the movie a typical desi movie. It wasnt even well made with songs and action sequences all in the wrong places. Worth a one time casual watch.
RATING: 3/5
Rating system explained:
1. All the people involved with the movie should be shot
2. One of the worst movies I saw
3. Worth watching once
4. Good movie, watch it on screen then on DVD
5. Best movie ever!!

Tuesday, May 09, 2006

Graduation

I don't have anything interesting to write but an event in the magnitude of MY graduation is atleast worth a mention on this otherwise very entertaining blog.
The following is pic of most of the desi loosers who graduated with me, i hope they won't get offended by my description of them, but deep down their heart they know it too!

If you have nothing better to do, you can also watch the Graduation Video.

Sunday, May 07, 2006

Mission Impossible III

Mild spoilers ahead...but it wont spoil the movie for you.
Got my hopes up for no reason. The movie was all about how much of a dare-devil super agent 'Ethan hunt' is, how fast he can run, how he can overcome the effect of a potentially dangerous time release chemical capsule pumped directly into his brain, with no suprises or event a decent script. The only thing good about the movie was sound during the actions scenes, i guess you'll have to go to theater to enjoy even that. Philip seymore hoffman was good as the bad guy. He brought fear into every scene he was in. All in all, the first summer block buster is purely designed for kids and people with an appetite for destruction. Hopefully the other summer movies are not as disappointing. I am purely banking on these movies to get me through the post- education,pre-job depression.

Thursday, April 06, 2006

I am Done!


The Holy grail of all master students...
Many lives were lost in pursuit of this...
I found it today, locked away in a small cabinet gaurded by nice lady, in a certain BEH building, in a far corner of USF.
It was a happy moment, for few seconds...
Then I realised, what an anti-climax......all this for a Sticker!!?!!
So, I decided to get drunk and forget what happened the last 2yrs 8months. No, it's not 3 years yet and don't be rude mentioning it around me, I might just cry, hehehe

Thursday, March 23, 2006

Thesis Comics



Source:Phd Comics

Cricket World Cup 2007 Tickets

I don't know if you've seen this already but, if someone understands the ticket funda please tell me:Cricket World Cup 2007

Saturday, March 18, 2006

V for Vendetta

Saw the movie today and I liked it. I only saw the movie because it involved the Wachowski brothers. Some of the scenes were really nice, but it was more Alan moore's genius (the guy who wrote the comic book) than the Wachowski brothers. I bought the comic book on Amazon for $12, a month back. But the the movie is quite different from the comic. Although, it spoiled most of the movie surprises for me, if you didnt read the comic book you might like it even better. You don't have to figure out anything in the movie but its a nice passionate movie of something which may not even happen in the future! V is played by Hugo Weaving, Agent smith from Matrix.
Although there is a lot of philosophical and literary dialogs in the movie, my favourite dialog was:
WOMAN: What a coincidence? Funny you came today, because just today morning I was given a red carson which reminded me of you?
V: There is no coincidence, just an illusion of coincidence?
WOMAN: Are you going to kill me now?
V: I killed you 10 mins back when I injected you with this needle in your sleep.

Thursday, March 16, 2006

Twilight Zone

Have you ever been in zone when you expect everything to go wrong and you get used the feeling and all the bad luck seems to be normal and suddenly when a simple thing works in your favour it makes you feel like the luckiest person in the world!!?!!
By the way I did a 'background check' on Murphy, my old friend, apparently he was no philosopher, he turns out to be a rocket scientist.

It's hard out here for a pimp!!!

Can you believe that a song with that title actually won the Best Song @ Oscars!!!
I heard it today for the first time and I liked it a lot, pump up the volume for this one!
Since my Blog is going nowhere I decided to list "TOP 5 SONGS I HEARD" every week. It wont be all new songs or anything, just the songs i hear.
Here goes...

TOP 5 SONGS I HEARD THIS WEEK
1.It's hard out here for a pimp-Hustle and flow Soundtrack
2.Dime that top of the line-Mike jones
3.Outkast-Karmacy
4.Grillz-Nelly
5.Patsala-Rang de basanti
6.Ashique Banaya-Kalyug(bonus)

Wednesday, February 08, 2006

Video-Ramchander Dancing

Funny as hell....hehehehe



(Thanks to GoogleVideo)

Video-Me Batting

Just learnt how to embed Google Video, so here is a treat to all the cricket fans out there.....

Cricketer Sunil, Hehehehehe.....



(Thanks to GoogleVideo)

Thursday, January 12, 2006

Patent Idea...

Somebody should install a voice recognition software to scan our phone messages for phone numbers(other than one they are calling from) and then automatically add those numbers to our call list so that we dont have to listen to the 10 digit phone numbers a million times before we finally write it down on a piece of paper or worse... key it in on our cell phones.

I dont know anything about patents, if you do please leave a comment, once i get paid for the patent i will give you half of it, hehe.

Sunday, January 08, 2006

Fake Art Appreciation!!!


How to fake an appreciation for Art???

Click Here

Informative and funny...
(Image from Wikipedia and article from About.com)