Shreya’s innocence
May 26th, 2006
So we are all sitting in the living room watching TV and this beautiful girl shows up in a music video or a commercial or something. Her name is Asin and she is popular movie star in South Indian cinema.
I ask Chukku(that’s what i call Shreya) if she knew the name of the girl on TV. She took a look at her and said “Umm…No”. I told her it was Asin and then asked her whether she thought Asin was beautiful.
She paused for a second and ignored my question. I asked her again and looked at me and then looked away and mumbled “yeah..she is beautiful”.
Then she said the most incredibly sweetest and innocent thing i have ever heard from her.
With a serious I-am-not-kidding-about-this-and-don’t-ever-ask-me-that-question-again tone, she said
“But i like Mommy.”
Gotta love kids man…
Smart navigation alternative
May 23rd, 2006
So in this project that i’m working on at my workplace, we have a bunch of products’ details displayed in a grid whose prices can be overridden by the admin user. The user has to check a “Override” checkbox, which would enable the price textbox. Uncheck obviously means the price cannot be overridden and textbox would be disabled. For business reasons, we had to use the autopostback option for the override checkboxes.
Anyways…the challenge was that there were atleast 25 or more products displayed in the grid and thus as you can imagine, when the user checked the bottom most product’s override checkbox the page posted back and auto-scrolled to the top of the page. This could be very annoying to the user and apparently, Smart Navigation was neither smart nor navigated anywhere expected and forced me to rely on Javascript to solve this issue.
After some googling, here’s how i fixed it.
There’s a javascript property called location.hash
bq. hash is a property of both the Link and the Location objects and is a string beginning with a hash (#). It specifies an anchor name in an HTTP URL.
For example, if the url is something like http://www.example.com#anchor
then #anchor is the hash property.
What this means is that if you have the id of an element in the page, you can set the focus to that element, when the page loads by using the location.hash property.
If you are using the a element , then you may use either the id attribute or the name attribute.
So i wrote a little procedure in the aspx’s code-behind that looks like this:
Private Sub anchorScript(ByVal productId As String)
Dim Script As String
Script &= "" & Environment.NewLine
Script &= "var anchorLocation='#" & productId & "';" & Environment.NewLine
Script &= "location.hash=anchorLocation;" & Environment.NewLine
Script &= "" & Environment.NewLine
If (Not Page.IsStartupScriptRegistered("anchorScript")) Then
Page.RegisterStartupScript("anchorScript", Script)
End If
End Sub
And called this procedure after doing the necessary stuff in the checkbox’s CheckedChanged event handler. Typically this would be the last line in the sub.
The above procedure registers a javascript function that when rendered, would look like this :
var anchorLocation='#' location.hash=anchorLocation;
This would tell the browser to focus on the element that has an id(passed into the anchorScript procedure).
Simple. Worked like a charm.
Observing a pattern in textpattern
May 21st, 2006
I must admit it is a lot of fun setting up a site using textpattern. Especially when it is on a windows box and apparently, you need to install PHP and MySql before you install any php based CMS like textpattern or wordpress. Trust me. It is NOT fun at all. Convincing Windows Server 2003 that PHP is not all that harmful is a pain in the butt. But heyy…i learnt so much in the process which is awesome (as long as i don’t forget it, which i will pretty soon – all credit goes to my selective amnesia. God…not again!).
Anyways…after a lot of procrastination, i finally decide to work on my site. For those who don’t know me that well, i already had a website that i had to pull down, out of sheer embarassment after i saw my colleague Jared’s site cuz mine looked like crap! Seems like he’s changed it at least twice since the original design based on which i took mine down. Not sure if i like it though. Oh well! He seems to like it and guess that’s all that matters. Jared’s online presence is referred to as “F***ing awesome” on Garrett’s site.
Here’s Luis’s joint which was built on textpattern too just as with Garrett and Jared. He said he’d help me set mine up. Hopefully when mine is done, i don’t have to take it down for at least another year. So far so good…