Tuesday, November 3, 2009

Who cares if you know the answer ?

Since Microsoft's MVP award has become common knowledge, many people in the same parts of the world as the outsourcers who fuel this blog, work mighty hard to answer any question they can, in the hopes of getting an award for their resume. This means that any basic question is likely to get 20 answers, all exactly the same. What's worse, is when people plainly have no idea, but give it a shot anyhow. Someone today asked a question, I won't reproduce it here, not least because the post was quite long, and intelligent. However, he had this code:

<input id="Bt_Descarga" class="" visible="TRUE" style="width: 100px" type="button" value="Download" onclick="Download(txtFile.text)" />

which then called this function:

<script type="text/javascript">
function Download(nom_fich)
{
window.open("Downloadfile.aspx?ar=" + nom_fich,"Download","width=10,height=10,resizable=yes;top=200,left=150,menubar=no,toolbar=no,status=no,location=no");
}
</script>


His problem is that the query string parameter is always null. The issue is that txtFile.text is server side code, he needs instead to get the client side id, look it up and then look up the control on the client to get it's text. Someone answered as follows:


You should pass it in single qoute.

window.open("Downloadfile.aspx?ar='" + nom_fich + "'



regard
Imrankhan


What ? If I think I know an answer and I'm not sure, I create a project to test my theory. I only have to look at the URL in my browser to confirm that strings in a query string variable are not in quotes ( not that I didn't know that already ).

What makes this worse is, because these people are typically looking to be given code and NOT forced to understand it, sometimes I've found myself as a voice in the wilderness, as I give good advice, and they ignore me and talk to someone with bad advice, who posts some code. The biggest example of this is the CreateGraphics method, which is designed for drawing rubber bands, etc, because what it draws, is erased as soon as a window is obscured in any way. People were using it as their main way of drawing, which is plain wrong, they need to instead handle their paint event. There was a time when I was constantly posting to tell people this was the wrong way to do things, and so often, I would be ignored as they continued to ask questions of the person who was helpfully giving them code that was basically useless, although it appeared to work if you tried it briefly. Which is how I expect that the delivery day of most of these outsourcing projects goes.

No comments:

Post a Comment