New App This Friday / Programming Challenge

New App Coming

On Sunday I sat down and programmed up a new online app. I might tweak it a bit between now and then, but as of right now it’s essentially done. I’ll post it up later this week – most likely Friday or Saturday. Since I wrote it in one day, you can assume it’s pretty small, it’ll be cool though! I actually really like it (and I don’t like everything I make). It was on my list of “stuff to do on a rainy day”. Sunday wasn’t actually rainy, but I was tired and I realized I hadn’t released anything here in a while, so I thought I’d take a stab at it.

I had been working on another online app, which I’ve mentioned a few times here before, but it was a bit too ambitious and I’ve lost interest. So it’s offically been abandoned for the moment. I may come back to it later though.

Programming Challenge

While reading some more of Steve Yegge’s blog entries, I ran across a very interesting programming question. It came from an entry Yegge wrote on doing phone interviews. He would always ask potential candidates the following question (or a variation of it):

Last year my team had to remove all the phone numbers from 50,000 Amazon web page templates, since many of the numbers were no longer in service, and we also wanted to route all customer contacts through a single page.

Let’s say you’re on my team, and we have to identify the pages having probable U.S. phone numbers in them. To simplify the problem slightly, assume we have 50,000 HTML files in a Unix directory tree, under a directory called “/website”. We have 2 days to get a list of file paths to the editorial staff. You need to give me a list of the .html files in this directory tree that appear to contain phone numbers in the following two formats: (xxx) xxx-xxxx and xxx-xxx-xxxx.

How would you solve this problem? Keep in mind our team is on a short (2-day) timeline.

Aparently 25%-35% of the software developers he asked this question to could not solve it. So give yourself a pat on the back if you think you’ve got a solution. Once you’re sure on what you’d do, click here to see what the best solution would be. I was actually estatic that I got it, though I’ve been using Unix a lot at work, and I’ve been reading up on regexes, so it’d be pretty bad if I didn’t get it. If you’re not a programmer, reading that solution will make no sense to you. This is the blog entry it’s from. It’s basically an article on what you should know when you go into an interview for a software development position.

4 thoughts on “New App This Friday / Programming Challenge”

  1. I’d simply enumerate the list of files, loop through each one, use regular expressions to detect a phone number, and then add it to some form of a queue list. Unfortunately I am terrible at implementing regular expressions.

  2. Recognizing you’d use regular expressions is probably the most important part. If you don’t develop on Unix you probably don’t know about the grep utility. You can call it from the command line and it will search a list of files (like a say from a directory or directory structure) for a given regular expression. It’s actually an amazingly handy tool.

    The school I went to, UMBC, actually had a unix environment for the students to develop in, but they did a poor job at getting people to learn all the useful commands and actually use the system. Since everyone was already familiar with Windows, most people would just develop their projects on their home PC and then ftp the files over to the UMBC server.

  3. Even I know to use a regex and I haven’t programmed in years! I’m glad you got the answer, Pat.

  4. hey chic! You are/were a pretty talented programmer. Surprisingly enough, I’ve asked this question to a few of my programmer friends and not all of them get it.

Comments are closed.