Monday, 22 December 2008

More efficiency in forums

I sometimes trawl asp and c# forums looking to share a little of my knowledge to people who are learning or perhaps are just stuck on one thing. Something really annoys me however, when somebody asks a question that would be the first Google hit on a search (like how do I assign a value to a textbox) or something that is obviously way above that person's skill level (I am designing a content management system, please tell me what to do). It wastes a lot of time and if people don't reply to these unreasonable requests then they might think there is a rudeness or arrogance to the business.

I list some suggestions to people, particularly who are new to software, that they can follow to get more helpful advice:


  1. Software is not something you can just start doing without some training. Spend some time in a classroom or on a dedicated tutorial web site before asking really easy questions. You would not expect to go onto a doctors website and ask for advice on drug doses if you were not medically trained.

  2. Do not agree to do a project that is far too difficult. If I am asked to do a job, I might not know everything but I will know enough to approach a problem and think about what I need to learn in order to be able to complete it. Asking somebody how to do the whole thing will not help anyone to give you advice and I'm not sure if you expect somebody to sit down and spend a day designing a system for you for free, just because you asked.

  3. Ask specific questions, you are more likely to get answers. If you ask "what style sets the strokethrough on a text label", you will probably get a quick and friendly reply. If you ask, "how can I write a music download site", you are unlikely to get anything helpful.

  4. Use the search engines. I cannot believe how many people do not start here. They are fast and effective although sometimes you need to know the correct words to search for.

  5. Ask friends/colleagues/teachers for help before asking complete strangers. They are more likely to be able to help and you will not spend hours trying to explain what you are doing.

  6. Pay somebody else to do it (if you are commercial anyway). Why should you get free technical support and design services. If you are able to do it - great, if not, you either don't get it or you pay. You wouldn't ask for a free car just because you can't afford one. Either that or improve your own knowledge and maybe you can do it.


There are lots of people like me who really do want to help people - even newbies - but are turned off by people who seem either lazy or unqualified to do what they are doing and not willing to pay for the right person.

Tuesday, 2 December 2008

Annonymous javascript function woes in IE

I have a control which senses any changes made in an ASP.net page controls and then if the user clicks away from the page without saving, an error is displayed. It works by iterating all controls on a page and attaching event handlers to onchange type attributes in various controls.

I've noticed a strange behaviour when running in IE7 which is fine in Firefox 3.0 this might be because Firefox totally ignores the offending code and there works by default or because it correctly places the annoymous function in memory.


if ( o.tagName == 'SELECT' )
{
if ( o.onchange == null )
{
o.onchange = SetDirty ;
}
else
{
var oldevent = o.onchange ;
o.onchange = function()
{
SetDirty();
oldevent();
}
}
}

I know there is a way to add an event handler instead of using the function but it also does other things (not shown) which means the annoymous function was chosen. What happens is that after this code is called on 3 drop-down lists, ALL 3 end up pointing to the oldevent of the 3rd list rather than their own events. It is as if the annoymous function is placed statically in memory and the last call to it points the oldevent() at the 3rd event handler. This is very annoying since my 3rd drop list invokes a postback which my 2nd list doesn't so whichever way round I put the code, I either get post backs where I don't want to (and not the javascript I am supposed to call) or I don't get postbacks when I need them. Strangely Firefox doesn't do this. I would appreciate it if anyone knows whether the whole approach is wrong (ie wrong syntax) or whether IE just has a bug in this regard. My work around is to hard code the change tracking javascript and customise it for each control but that is not very neat or maintainable.