News for hackers. Stuff that matters.
Re:Ask HN: Average coder at dead-end. What now? by patio11 on Sunday June 20, 2010 @11:00PM (#1447779)
The typical engineer is not a genius. Don't compare yourself to geniuses. The typical engineer also makes more than you do, and you should find a job and close that gap. If you are feeling like you are unworthy, go talk to any chaps in London about the guys making 50k sterling while being unable to do FizzBuzz. (I assume you have them in London, too.)

If you're worried about your portfolio being insufficiently graphically impressive, well, pick an off-the-rack template which looks pretty, then build an example site off of that. You can reference the case studies of what you've done without actually showing the sites. Just tell people that your previous bosses are uptight corporate types.

The Internets is full of people looking for competent PHP developers, if you can't find them locally. Network network network, develop a speciality, blog, all the usual advice here.

Re:Ask HN: Average coder at dead-end. What now? by mbenjaminsmith on Monday June 21, 2010 @12:32AM (#1447961)
Is FizzBuzz actually used as a coder test? Are their really paid coders out there who can't solve that in a couple minutes?
Re:Ask HN: Average coder at dead-end. What now? by aerique on Monday June 21, 2010 @01:26AM (#1448062)
Yes.

On a bad day can't solve some of those interview problems. (and I think of myself as an average coder although I try to mitigate that handicap by building from the ground up and testing those components well)

Re:Ask HN: Average coder at dead-end. What now? by ebtalley on Monday June 21, 2010 @01:15AM (#1448037)
I just got thrown the FizzBuzz test a couple days ago. First time I had ever seen it. Startled me that everyone else knows what it is too! I don't know if it would be blindingly obvious without the mod operator.
Re:Ask HN: Average coder at dead-end. What now? by patio11 on Monday June 21, 2010 @01:37AM (#1448081)
Let's see: x / y * y == x iff x % y == 0, if your language handles integer division like most do.

If your language doesn't do integer division that way, the naive approach is even easier if you know how to round: x / y == round(x / y) iff x % y == 0.

There are many, many other approaches which will work, too. I saw one guy hand-build an array of ints, initialize to zero, loop over it once with arr[i++] = 0; arr[i++] = 0; arr[i++] = 3 to set the multiples of 3, then do the same thing with the fives except checking to see if there was already a 3 there, then looping over the array a fourth time to handle the actual printing.

That is the kind of competent, worksmanlike programming that runs the world while the can't-do-FizzBuzz guys are hopefully not touching the code too much.

Re:Ask HN: Average coder at dead-end. What now? by pyre on Monday June 21, 2010 @01:30AM (#1448071)
I would consider the mod operator to be pretty basic though. (Feel free to call me out if I'm just being naive.)

Outside of the mod operator, you could always use a combo of floor() and ceiling() (which I assume most languages have in a standard library). e.g.:

  from math import floor,ceil
  def divisible_by_3(n):
    result = n / 3.0
    return ceil(result) == floor(result)
Or even more basic:

  def divisible_by_3(n):
    result = n / 3.0
    return int(result) == result
Re:Ask HN: Average coder at dead-end. What now? by chipsy on Monday June 21, 2010 @02:33AM (#1448166)
The main danger with using the mod operator is that you can get an off-by-one if you aren't in the habit of using it and forget the exact definition. If that's in doubt, rolling your own thing with a division or a while/if makes for a stronger guarantee of success on the first try.

In an interview you could explain your reasoning for such a detour as well, which might work out better than just "knowing the answer."

Re:Ask HN: Average coder at dead-end. What now? by robinduckett on Monday June 21, 2010 @05:25AM (#1448340)
I used the old int(i) == i (or even, int(i/2) == i/2) way before I knew about the mod operator.
Re:Ask HN: Average coder at dead-end. What now? by robinduckett on Monday June 21, 2010 @05:21AM (#1448333)

    var s = require('sys');
    for (var i = 1; i < 101; i++) {
      if (i%3 == 0 && i%5 == 0) s.puts('fizzbuzz');
      else if (i%3 == 0) s.puts('fizz');
      else if (i%5 == 0) s.puts('buzz');
      else s.puts(i);
    }

    node.fizzbuzz.js
Re:Ask HN: Average coder at dead-end. What now? by Uchikoma on Monday June 21, 2010 @01:46AM (#1448099)
Yes, about one third I interview can't FizzBuzz (thank god for http://typewith.me/ )
Re:Ask HN: Average coder at dead-end. What now? by ceilingfish on Monday June 21, 2010 @04:45AM (#1448301)
One test I commonly use in interviews is to ask candidates to write a function to sum up an array of values. A scary volume of them can't manage it at all.
Re:Ask HN: Average coder at dead-end. What now? by wgj on Monday June 21, 2010 @12:45AM (#1447985)
Yes. Yes.
Re:Ask HN: Average coder at dead-end. What now? by mechanical_fish on Monday June 21, 2010 @12:54AM (#1447997)
Of course.

If you can't understand how this can happen you need to read The Peter Principle.

http://en.wikipedia.org/wiki/Peter_Principle

Re:Ask HN: Average coder at dead-end. What now? by krakensden on Monday June 21, 2010 @12:55AM (#1448002)
That's why it's so popular :(