News for hackers. Stuff that matters.
Re:Ask HN: Who's Hiring? (January 2011 Edition) by lkrubner on Saturday January 01, 2011 @11:58AM (#2057833)
In New York City there are a lot of jobs. I went to 3 job interviews and got offers from 2. All 3 had tests of my programming skill, though the 3rd was ruthless about minor syntax errors. For instance, the guy talking to me asked me how to find all of the Apache servers running on a server. He just wanted the number. I typed:

ps aux | grep apache | wc -l

but this wrongly included the command I was typing. We were working on their dev server and I was typing the commands into the terminal. I got back 12 when the real answer was 11. He eventually showed me what I should have typed:

ps aux | grep apache | grep -v grep | wc -l

The grep -v screens out the line I had just typed which had "grep apache" in it. Of course, there are other ways to do this, but this was the first thing I thought of. Of my error, I thought that was somewhat minor, but this guy had recently been hired to clean up a sloppy programming department, so he was looking for programmers who were flawless.

The other 2 tests at the other 2 jobs covered the usual questions (write a JOIN statement, write a sub-query, what is the difference between GET and POST?). On one of the interviews, 2 programmers came in to talk to me and they gave me a short PHP script which was working but which was badly written. They asked me how I would re-write it. Easy enough.

My sense is there is a lot of hiring going on in New York City. Possibly not enough local talent to fill all the jobs, but the businesses are here for other reasons (other than programming talent) so I think eventually programming talent from elsewhere will get drawn to New York City. There are some cities in the USA that are in deep economic decline, and will probably remain so for the next 5 years, so perhaps some of the programmers from those cities will migrate to New York City.

Re:Ask HN: Who's Hiring? (January 2011 Edition) by ericb on Saturday January 01, 2011 @12:05PM (#2057848)
Email him this, which is more succinct and does the same:

ps aux | grep [a]pache | wc -l

(because you use the character class, it doesn't find itself as what it searches for is different than its text)

Re:Ask HN: Who's Hiring? (January 2011 Edition) by Timothee on Saturday January 01, 2011 @12:40PM (#2057908)
[OT] Wouldn't "ps aux | grep -c [a]pache" work the same way? Everyone seems to put "| wc -l|" but I have used the -c option to do that directly.
Re:Ask HN: Who's Hiring? (January 2011 Edition) by twp on Saturday January 01, 2011 @12:10PM (#2057860)
Or just

pgrep httpd | wc -l

Re:Ask HN: Who's Hiring? (January 2011 Edition) by snorkel on Saturday January 01, 2011 @02:02PM (#2058096)
Or just

pgrep -c apache

Re:Ask HN: Who's Hiring? (January 2011 Edition) by bch on Saturday January 01, 2011 @07:23PM (#2058933)
kamloops$ pgrep -c apache

pgrep: unknown option -- c

Usage: pgrep [-filnvx] [-d delim] [-G gid] [-g pgrp] [-P ppid] [-s sid] [-t tty]

             [-U uid] [-u euid] pattern ...
kamloops$ uname -sr

NetBSD 5.99.42

kamloops$

edit: formatting.

Re:Ask HN: Who's Hiring? (January 2011 Edition) by tocomment on Saturday January 01, 2011 @02:40PM (#2058208)
I consider myself a good developer but that grep apache thing is something I would have to look up.

I only use grep once or twice a month on average. Why do employers expect you to have every possibly relevant thing memorized? I hate it. </rant>

Re:Ask HN: Who's Hiring? (January 2011 Edition) by BrandonM on Saturday January 01, 2011 @08:24PM (#2059057)
I use grep several times a week. If the job is one that will leverage command line skills, it would make sense to understand grep. It's not like "grep [f]oo" is an alien command; it's basically a pattern.
Re:Ask HN: Who's Hiring? (January 2011 Edition) by tocomment on Sunday January 02, 2011 @09:36AM (#2060068)
I do see your point but still if you have an otherwise good web developer I'm sure he can learn grep.

I've been meaning to make a web comic where software companies end up with Exactly the employees they interview for. Eg the boss asks "why the does the guy we hired keep solving project Euler problems all day?"

Re:Ask HN: Who's Hiring? (January 2011 Edition) by cd34 on Saturday January 01, 2011 @12:42PM (#2057915)
ps ax|grep -Ei '(apache|httpd)'|grep Ss|wc -l

lsof|grep TCP|grep -Ei '(apache|httpd)|cut -f 1 -d ' '|sort|uniq|wc -l

apache -S 2>&1|grep server|wc -l

apache2ctl -S 2>&1|grep server|wc -l

are processes/threads really servers? His question was a bit ambiguous. I wouldn't have accepted that job position either. :)

Re:Ask HN: Who's Hiring? (January 2011 Edition) by brentoids on Saturday January 01, 2011 @05:00PM (#2058580)
Ambiguous questions are great to ask candidates. It helps to filter out those that neither realize the ambiguity nor ask clarifying questions. Questioning before compliance is a valuable important trait.
Re:Ask HN: Who's Hiring? (January 2011 Edition) by cperciva on Saturday January 01, 2011 @12:02PM (#2057838)
Completely off-topic, but...

  ps aux | grep apache | grep -v grep | wc -l
A more succinct, albeit less portable, alternative is 'pgrep apache | wc -l'. (Or 'pgrep httpd | wc -l', depending on your apache commandline.)