Every good book on software engineering tells you something like that: “If your code doesn’t work, chances are 95% that it’s your fault”. But it’s easy to forget when you’re debugging for a couple of hours or days. This is why problem-solving questions are popular in technical interviews. Can you distance away from the problem, look at it at different angle, do backtracking, line up all the facts, and aha!—find an `obvious’ solution?
To recap this, read this small post of Jeff Atwood and follow the links he provided.
BTW, by `select’ he means not SQL’s `SELECT’, but UNIX `select(2) ‘ system call. Interesting, that once I was in a similar situation too. What I discovered is that the example of `select’ usage isn’t descriptive enough and provoked me to do a stupid error.