Wednesday, July 27, 2005

RTFM (again)

When I first started pair programming it took me about 2 hours to come to terms with the fact that sometimes you need to ask for help, and that it's OK to look in a manual. You won't lose face with your pair for doing that.

It took our boss about 2 weeks to notice the increase in traffic on uk.php.net caused by my arrival.

So why is it that whenever I'm coding on my own I will tend to try to hack through the undergrowth with a pen knife to get to the solution rather than ask someone if I can borrow their chainsaw?

The latest example is a problem I was having with a firefox extension.

I wanted the user to be able to select a piece of text, right click, pick my extension and have a dialog box where one of the fields contains the selected text.

Since I already knew how to do this I flew straight in and spent ages fiddling round in the dialog box's code with parent.getSelection(), parent.window.getSelection, parent.window.context.getSelection() and every other combination including parents, windows and selections that I could think of. Not a chance.

For some reason I couldn't get the text from the parent window. I suspect that firefox does not regard the window the user sees as the parent window, but I've not bothered looking to find out...

Anyway, quite early on in I thought to mayself:

'This would be easy if you could just pass arguments into the dialog box. I could just get the selection in the code that kicks off the dialog box and there we go'.

But since I knew window.open I knew this wasn't possible.

An hour later I decided to take a look at openDialog, which is the call I was actually making to open the window. It turned out that yep, you can pass arguments into the child dialog box.

If only I'd just accepted that I don't know everything and looked at it an hour earlier I'd have saved myself a lot of stress.

Note to self... RTFM!

0 Comments:

Post a Comment