jQuery fundas

Posted July 31st, 2010. Filed under Code

Interestingly, I always used e.preventDefault with asp.net controls (specifically buttons), to prevent a post-back, and thought it was simple as it could get…until I bumped into this.

http://css-tricks.com/return-false-and-prevent-default/

So, note to self, update all usages of jquery’s e.preventDefault() with e.preventDefault();e.stopPropagation();

or…even more plain and simple…use return false;

The above link however provides even better information on why !

Zune player for Win 7… Windows 7 ready.

Posted July 9th, 2010. Filed under Uncategorized

imageI always felt Win 7 was all cool and awesome…but this today gave me a pleasant surprise.

Including JS file references in masterpages

Posted June 28th, 2010. Filed under Code

One of the issues I have faced with including site-wide JS files while developing web-applications is the simple fact that I was developing in Windows XP and IIS 5. And IIS puts in each of my websites as virtual-directories. So , I always have trouble including references to js files from the master-pages.

One alternative was to have a virtual directory outside the project structure and point it to the js folder, and my references would work properly. But there are other nicer ways to do the same.

1. Include the script tag as a server side tag, and give the reference to the file with a "~"

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Master page</title>
    <script language="javascript" src="~/App_Common/Scripts/tablecloth.js" runat="server"></script>
</head>
<body>

2. Add some code to your masterpage’s load event that would register the file after resolving the client url.

protected void Page_Load(object sender, EventArgs e)
 {
     this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "tableCloth", this.ResolveClientUrl("~/App_Common/Scripts/tablecloth.js"));
 }

The above two approaches completely avoid having to create a virtual directory of any kind, and work all the time … so long as the path is correct.

You know…

Posted June 15th, 2010. Filed under Quotes

It’s waking up in the middle of the night for no reason, shifting under the blankets and feeling the heat of the person next to you. You turn around and see them in their most peaceful, innocent, and vulnerable state. They breathe as though the weight of the world lays on anyone’s shoulder but their own. You smile and kiss their face gently before turning back around and somehow, an involuntary grin forms on your face. Just before you drift off to sleep, you feel an arm wrap around your waist and you know… Source : http://bit.ly/aOQNKV

Your life is a vacation…

Posted June 15th, 2010. Filed under Quotes

Instead of always waiting for your next vacation, you ought to create a life you don’t need to escape from. ~Makes Me Think

Your life…

Posted June 15th, 2010. Filed under Quotes

Look at you. You’re young. And you’re scared. Why are you so scared? Stop being paralyzed. Stop swallowing your words. Stop caring what other people think. Wear what you want. Say what you want. Listen to the music you want to listen to. Play it loud as fuck and dance to it. Go out for a drive at midnight and forget that you have school the next day. Stop waiting for Friday. Live now. Do it now. Take risks. Tell secrets. This life is yours. When are you going to realize that you can do whatever you want?

– Source : http://www.goodmorningandgoodnight.com/?p=3351

Ideas

Posted June 15th, 2010. Filed under Quotes

If at first, an idea does not sound absurd, then there is no hope for it.

– Albert Einstein.

Remember the idea…not the man

Posted June 15th, 2010. Filed under Articles

We are told to remember the idea, not the man. Because a man can fail. He can be killed and forgotten. But four hundred years later an idea can still change the world. I’ve witnessed firsthand the power of ideas. I’ve seen people kill in the name of them; and die defending them. But you cannot touch an idea, cannot hold it or kiss it. An idea does not bleed, it cannot feel pain, and it does not love. And it is not an idea that I miss, it is a man. A man who made me remember the fifth of November. A man I will never forget.” ~V for Vendetta

Ramayan 2.0

Posted May 8th, 2010. Filed under Articles

A young second generation Indian in the US was asked by his mother to  explain the significance of “Diwali” to his younger brother, this is how he went about it.

“So, like this dude had, like, a big cool kingdom and people liked him.  But, like, his step-mom, or something, was kind of a bitch, and she forced her husband to, like, send this cool-dude, he was Ram, to some national    forest or something… Since he was going, for like, something like more  than 10 years or so… he decided to get his wife and his bro along… you know…so that they could all chill out together. But Dude, the forest was reeeeal scary shit… really man…they had monkeys and devils and shit like that. But this dude, Ram, kicked with darts and bows and arrows… so it was fine.

But then some bad gangsta boys, some jerk called Ravan, picks up his babe  (Sita) and lures her away to his hood. And boy, was our man, and also his bro, Laxman, pissed… all the gods were with him… So anyways, you don’t mess with gods. So, Ram, and his bro get an army of monkeys… Dude, don’t ask me how they trained the damn monkeys… just go along with me, ok…  So, Ram, Lax and their monkeys whip this gangsta’s ass in his own hood…  Anyways, by this time, their time’s up in the forest… and anyways… it  gets kinda boring, you know… no TV or malls or shit like that. So,they decided to hitch a ride back home… and when the people realize that our  dude, his bro and the wife are back home… they thought, well, you know,
at least they deserve something nice… and they didn’t have any bars or clubs in those days… so they couldn’t  take them out for a drink, so they, like, decided to smoke and shit… and
since they also had some lamps, they lit the lamps also…so it was pretty cooool… you know with all those fireworks…. Really, they even had some local band play along with the fireworks… and you know, what, dude, that was the very first, no kidding.., thatwas the very first music-synchronized fireworks… you know, like the 4th of July stuff, but just, more cooler and stuff, you know. And, so dude, that was how, like, this festival started.”

The mother fainted…

When the good lord was creating fathers !!

Posted May 8th, 2010. Filed under Articles

When the good lord was creating fathers, he started with a tall frame. A female angel nearby said,” What kind of father is that? If you are going to make children so close to the ground, why have you put fathers up so high? He won’t be able to shoot marbles without kneeling, tuck a child into bed without bending, or even kiss a child without a lot of stooping”. And God smiled and said, “Yes, but if I make him child size, who would children have to look up to?”

And when god made a father’s hands, they were large and sinewy. The angel shook her head sadly and said,” Large hands are clumsy. They can’t manage diaper pins, small buttons, rubber bands on pony tails or even remove splinters caused by baseball bats”. And God smiled and said,” I know, but they’re large enough to hold everything a small boy empties from his pockets at the end of the day, yet small enough to cup a child’s face.”

And then God molded long, slim legs and broad shoulders. The angel nearly had a heartattack. “Boy, this is the end of the week all right,” she clicked. “ Do you realize you just made a father without a lap? How is he going to pull a child close to him without the kid falling between his legs?”. And God smiled and said, “A mother needs a lap. A father needs strong shoulders to pull a sled, balance a boy on a bicycle or hold a sleepy head on the way home from a circus.”

God was in the middle of creating two of the largest feet anyone had ever seen when the angel could contain herself no longer. “That’s not fair. Do you honestly think those large boats are going to dig out of bed early when the baby cries? Or walk through a small birthday party without crushing atleast three of the guests?” And God smiled and said, “they’ll work. You’ll see. They will support a small child who wants to ride a horse to Ban bury cross or scare off mice at the summer cabin or display shoes that will be a challenge to fill.”

God worked throughout the night, giving the father a few words but a firm, authoritative voice and eyes that saw everything but remained calm and tolerant. Finally, almost as an afterthought, he added tears. Then he turned to the angel and said,”Now, are you satisfied that he can love as much as a mother?”

- Erma Bombeck

Disclaimer : This article came to me via email from GoodCleanFun@yahoogroups.com sometime between 2001-2004