Comment On A Problem at the Personal Level & More

A Problem at the Personal Level From Shari [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7 | Page 8Next »

Re: A Problem at the Personal Level & More

2008-09-24 11:06 • by Alan (unregistered)
“Oh,” he scoffed, “so, we’re equals now, is that it?”

No. I'm not an asshole. Good day.

Re: A Problem at the Personal Level & More

2008-09-24 11:08 • by crystal mephistopheles

“Oh, okay,” the candidate replied. He pondered for a full minute and said “so in that case, I would hae the Watcher listen on a TCP/IP port, and have the Downloader tell it when it was done downloading.”

“That seems like a lot of work,” I said....


I don't think it's fair to say network I/O is "a lot of work". Granted, his temporary directory solution is even simpler, but most high level languages (.NET, Java, etc.) have fully defined classes you can use to implement this in only a few lines of code, and I would classify this as an acceptable solution.

Re: A Problem at the Personal Level & More

2008-09-24 11:09 • by MiffTheFox
First!

And if it's not first, I'll just patch CS so it identifies all third comments as first.

Re: A Problem at the Personal Level & More

2008-09-24 11:10 • by Max (unregistered)
Oh, seriously. Each one of these is a job you shouldn't take anyway.

1) Obvious reasons...
2) An interviewer who thinks downloads in progress are a problem but file copies in progress are not shows a lack of understanding.
3) Interviews are two-way -- if the people interviewing you are clueless, the job will suck.

Re: A Problem at the Personal Level & More

2008-09-24 11:12 • by Outlaw Programmer
219059 in reply to 219057
Disagree on (3) here. The people interviewing him weren't clueless. This kind of "fizz-buzz" problem is pretty common and it's amazing how many "developers" can't pull off the simplest things.

Re: A Problem at the Personal Level & More

2008-09-24 11:12 • by Azeroth (unregistered)
There is another simple solution with the downloader/watcher problem - downloader should open the file exclusively while it's being downloaded, this way watcher won't be able to access it until it's closed. This way it's not even required to move anything anywhere.

Re: A Problem at the Personal Level & More

2008-09-24 11:14 • by andrew (unregistered)
219061 in reply to 219054
This is actually a bit more graceful even. There is no polling involved of the directory, you know exactly when to process the file. This could be 100x better if the mount is NFS'ed. Also, what if you need to change the "copy" framework to something else. I think mv /tmp/foo /end/foo is fine to start but its not robust for large(r) scale or more complicated designs.

Re: A Problem at the Personal Level & More

2008-09-24 11:14 • by The Undroid (unregistered)
Better Dave should reveal his tendencies at the interview, even at the cost of an hour and a half wasted, than hire Shari and gradually work out whatever his problem is with Brown grads.

Also, how do we know there are no troublesome latencies in the Dowloader's local copy?

Re: A Problem at the Personal Level & More

2008-09-24 11:15 • by blabla (unregistered)
219063 in reply to 219057
Max:
2) An interviewer who thinks downloads in progress are a problem but file copies in progress are not shows a lack of understanding.


Umm... I think the guy said 'move' rather than 'copy', which is at least closer to atomic, if not atomic?

Re: A Problem at the Personal Level & More

2008-09-24 11:17 • by ThomasP (unregistered)
219064 in reply to 219057
I think you missed the part where they were talking about file moves in Linux, not Windows.

Re: A Problem at the Personal Level & More

2008-09-24 11:22 • by Marc (unregistered)
Rename?

Re: A Problem at the Personal Level & More

2008-09-24 11:22 • by jpaull
Speaking of bad recuiters... I once dealt with a recruiter that kept trying to hook me up with positions I was not qualified for. I only had a couple of years experience as a Developer and on three different occasions scheduled me for interviews for Senior positions, and then would be totally baffled when I would tell him that I bombed the interviews.

I wonder sometimes whether or not these recruiters get paid by the number of interviews they schedule and not by the number of positions they actually fill.

Re: A Problem at the Personal Level & More

2008-09-24 11:24 • by SoonerMatt (unregistered)
219070 in reply to 219065
Marc:
Rename?

Yeah I was thinking that too. Rather than make it move a 3 gb file (which could fail in itself), I would start the transaction as a .tmp file then remove the .tmp when it's completed.

Re: A Problem at the Personal Level & More

2008-09-24 11:24 • by asdsdf (unregistered)
219071 in reply to 219057
2) File copies/moves across a filesystem are (probably) much quicker than the downloading. The interviewer never said it was a problem with multiple processes accessing a file, just that if the Watcher reached the end of the file too quickly. If a copy/move can copy bytes faster than the Watcher can process the bytes, then it should be fine, no?

Re: A Problem at the Personal Level & More

2008-09-24 11:26 • by spenk
219073 in reply to 219057
Max:

2) An interviewer who thinks downloads in progress are a problem but file copies in progress are not shows a lack of understanding.


How about a lack of reading comprehension? Move, not copy - makes a big difference if the files are moving between folders / directories on the same volume.

Re: A Problem at the Personal Level & More

2008-09-24 11:27 • by smasher (unregistered)
219074 in reply to 219057
"moving" a file and "copying" a file are not the same. mv is hardly atomic, but if the file appears in the target directory, it's already been written to disk.

Re: A Problem at the Personal Level & More

2008-09-24 11:27 • by spenk
219075 in reply to 219070
SoonerMatt:
Marc:
Rename?

Yeah I was thinking that too. Rather than make it move a 3 gb file (which could fail in itself), I would start the transaction as a .tmp file then remove the .tmp when it's completed.


The watcher appears to process *whatever* files are in that particular folder - simply altering the extension might not be enough.

Re: A Problem at the Personal Level & More

2008-09-24 11:28 • by Alan (unregistered)
If you are qualified for the job - of course the test will be easy. My company does basic testing for every applicant and every new recruit slags of the test - until they see the reject pile.

That metaphor- I don't think it means what you think it means

2008-09-24 11:29 • by Gorfblot (unregistered)
A diamond in the rough is something that looks to be of little value, but is actually worth quite a lot once some polishing has been done. IE, You talked with one of the Tier 1 helpdesk people and realized they had some talent and were quick to learn. You get them some further training, move them to a junior development position, and in a short time they become a major contributor to success- That's a diamond in the rough.

Re: A Problem at the Personal Level & More

2008-09-24 11:33 • by snoofle
219080 in reply to 219066
jpaull:
Speaking of bad recuiters... I once dealt with a recruiter that kept trying to hook me up with positions I was not qualified for. I only had a couple of years experience as a Developer and on three different occasions scheduled me for interviews for Senior positions, and then would be totally baffled when I would tell him that I bombed the interviews.

I wonder sometimes whether or not these recruiters get paid by the number of interviews they schedule and not by the number of positions they actually fill.

I've found that sometimes recruiters will hold back some critical piece of info (say, requires relocation across the country) when they tell you how great the job is, so that you'll go to an interview you'd otherwise pass up. This way it looks like they're providing qualified candidates to the company.

It's a waste of your time, and if I find out about it before leaving the interview, I'll let the interviewer know that the headhunter wasted his time and mine, and perhaps they should use a different agent in the future. I come off honest and the loser headhunter gets what he deserves.

Re: A Problem at the Personal Level & More

2008-09-24 11:36 • by emurphy
219083 in reply to 219057
Max:

2) An interviewer who thinks downloads in progress are a problem but file copies in progress are not shows a lack of understanding.


As noted, atomic renames (and I think moving files to another directory is atomic even under Windows, provided you stay within the same volume, right?) shouldn't have this problem.

What if you can't modify the Downloader, either? Other than "replace one or both programs with something that can be modified", my first thought is to write a third program that also checks the remote site, and alters file permissions on the downloads-in-progress so the Watcher can't access them until the download is finished.

Max:

3) Interviews are two-way -- if the people interviewing you are clueless, the job will suck.


They were clueful enough to reject unqualified candidates. And it's possible (though I wouldn't bet on it) that the recruiter isn't a WTF either, that the pool of prospects just really is that lousy in that area (on the theory that good prospects get hired quickly while bad ones keep trying).

Re: A Problem at the Personal Level & More

2008-09-24 11:37 • by imMute (unregistered)
219084 in reply to 219057
Max:
\
2) An interviewer who thinks downloads in progress are a problem but file copies in progress are not shows a lack of understanding.


File copies would still be a problem, but file moves (also known as renames) are extremely quick as long as the src/dst are on the same volume: the FS only moves the inode data. Hell, even windows handles this as well as *nix.

Re: A Problem at the Personal Level & More

2008-09-24 11:37 • by snoofle
219085 in reply to 219052
Alan:
“Oh,” he scoffed, “so, we’re equals now, is that it?”

No. I'm not an asshole. Good day.

*bows in awe*

Re: A Problem at the Personal Level & More

2008-09-24 11:39 • by ST (unregistered)
Thanks for the interview tales, this is one of my favourite sections. Mind you, I'm pretty shocked at how many of the resident professionals are trying to come up with alternative answers for the problem in the second tale. Obviously you use a temp filename (ignored by the watcher) or a temp directory. What kind of mindset comes up with anything else? Especially consdering that the candidate is being prompted by the interviewer that he is looking for a simple solution. I don't think they lost any worthwhile talent by turning down that hire.

Re: A Problem at the Personal Level & More

2008-09-24 11:42 • by Aaron (unregistered)
If its in linux, the lsof command works quite well at telling you a file is still open, without having to modify the kernel or anything.

lsof | grep filename || start whatever you wanted

Re: A Problem at the Personal Level & More

2008-09-24 11:46 • by David Emery (unregistered)
219094 in reply to 219060
The "open exclusive" is the -right way*- to do this. If /tmp is located on a different file system/drive than the destination, then the file move operation is not guaranteed atomic. You can have the same problem on the disk copy than you have on the download (although the latency is less, it's certainly not zero.)

dave

(* I won't say "the only right way" but I might strongly imply it :-)

Re: That metaphor- I don't think it means what you think it means

2008-09-24 11:47 • by Someone You Know
219095 in reply to 219078
Gorfblot:
A diamond in the rough is something that looks to be of little value, but is actually worth quite a lot once some polishing has been done. IE, You talked with one of the Tier 1 helpdesk people and realized they had some talent and were quick to learn. You get them some further training, move them to a junior development position, and in a short time they become a major contributor to success- That's a diamond in the rough.


I don't think "IE" means what you think it means.

Re: A Problem at the Personal Level & More

2008-09-24 11:51 • by James (unregistered)
219096 in reply to 219094
David Emery:
The "open exclusive" is the -right way*- to do this. If /tmp is located on a different file system/drive than the destination, then the file move operation is not guaranteed atomic. You can have the same problem on the disk copy than you have on the download (although the latency is less, it's certainly not zero.)

dave

(* I won't say "the only right way" but I might strongly imply it :-)


a) since you're designing the fix, you can design it so the /tmp is on the same volume as the /final, so move is effectively guaranteed atomic

b) I was going to suggest having Watcher poll the filesize and do its scan a fixed time after it stops changing. I think that can work, if you're able to be sure that Downloader is using a protocol with a spec'd timeout. Assuming, of course, that Watcher is interested in failed downloads as well as those that finish...

Re: A Problem at the Personal Level & More

2008-09-24 11:52 • by wds (unregistered)
219098 in reply to 219084
imMute:
File copies would still be a problem, but file moves (also known as renames) are extremely quick as long as the src/dst are on the same volume: the FS only moves the inode data. Hell, even windows handles this as well as *nix.

All this assuming they're on the same partition right? So if they're not, you're in serious trouble. Considering how /tmp is the usual place to drop stuff in, and /tmp is often on another partition I don't see how this is an acceptable solution. Not to mention the problem with having allocated space in /var/program/blah but not in /tmp and thus running out of room to drop your multigig executables.

See I'd just have used a lockfile.

Re: A Problem at the Personal Level & More

2008-09-24 11:53 • by sibtrag
I'd say that expecting move to be atomic is a rather poor assumption. You certainly open yourself up to problems if the volume structure changes. For instance, someone replaces the local directory with a symbolic link to a large scratch disk if the multi-GB downloads are filling the disk (or interfering with other activity on that drive).

It may be more robust to download into another location & then create a symlink in the original directory.

Re: A Problem at the Personal Level & More

2008-09-24 11:53 • by Mike P (unregistered)
219100 in reply to 219089
ST:
Obviously you use a temp filename (ignored by the watcher) or a temp directory. What kind of mindset comes up with anything else?


Well, my first thought was "Start the Downloader, wait for it to complete, then start the Watcher".

Presumably the interviewer would have told me I couldn't do this, in which case the temp directory solution would have been my second answer.

On Linux (mentioned by the interviewer) "mv" is perfectly atomic provided both source and destination are within the same filesystem.

Re: That metaphor- I don't think it means what you think it means

2008-09-24 11:55 • by ThomsonsPier
219101 in reply to 219095
Someone You Know:
Gorfblot:
A diamond in the rough is something that looks to be of little value, but is actually worth quite a lot once some polishing has been done. IE, You talked with one of the Tier 1 helpdesk people and realized they had some talent and were quick to learn. You get them some further training, move them to a junior development position, and in a short time they become a major contributor to success- That's a diamond in the rough.


I don't think "IE" means what you think it means.


Internet Explorer? If that's the case, I make sure to pronounce it, 'AIEEEEEE!'

Re: A Problem at the Personal Level & More

2008-09-24 11:55 • by jwa (unregistered)
219102 in reply to 219098
And your whole response is predicated upon the assumption that the term temporary file meant strictly /tmp. Which is not always the case, more likely it was "a file which is temporary" not "a file in the system temporary directory".

Re: A Problem at the Personal Level & More

2008-09-24 12:01 • by Charles Duffy (unregistered)
219106 in reply to 219094
David Emery:
The "open exclusive" is the -right way*- to do this. If /tmp is located on a different file system/drive than the destination, then the file move operation is not guaranteed atomic. You can have the same problem on the disk copy than you have on the download (although the latency is less, it's certainly not zero.)


It's a move, not a copy. Moves within the same partition are atomic.

Moreover, the tempfile-and-move approach (where, yes, you put your temporary file in the same directory or otherwise somewhere known to be on the same partition) is the generally accepted solution to this problem; if you don't know it, there's no way in hell I want you on my systems engineering team.

Again, the problem the interviewer was looking for is the way every single UNIX developer with any kind of a clue does atomic file updates.

Re: A Problem at the Personal Level & More

2008-09-24 12:02 • by hatterson
219107 in reply to 219054
crystal mephistopheles:

“Oh, okay,” the candidate replied. He pondered for a full minute and said “so in that case, I would hae the Watcher listen on a TCP/IP port, and have the Downloader tell it when it was done downloading.”

“That seems like a lot of work,” I said....


I don't think it's fair to say network I/O is "a lot of work". Granted, his temporary directory solution is even simpler, but most high level languages (.NET, Java, etc.) have fully defined classes you can use to implement this in only a few lines of code, and I would classify this as an acceptable solution.


True, but this requires you to have access to both the downloader and the watcher. In the "ideal" solution you only need access to the downloader.

Re: A Problem at the Personal Level & More

2008-09-24 12:02 • by klenow
Is it just me, or does Jeremy sound like a bit of a jerk? He simply wouldn't let the guy use any solution that wasn't his pet solution. Seems the simplest solution is to have the Downloader activate the Watcher when it's done.

Re: A Problem at the Personal Level & More

2008-09-24 12:02 • by SomeCoder (unregistered)
Yeah, solution #2 is just great. Because we all know that every file system command is guaranteed to be atomic, right?

mv may be CLOSE to atomic but it's definitely not guaranteed to always be atomic. And if we suddenly have to change directories across partitions then it damn well is NOT atomic.

I think Jeremy H should get a better interview question.

Re: A Problem at the Personal Level & More

2008-09-24 12:03 • by Paul (unregistered)
re: File watcher.

Ignoring the fact that several people have raised that files appear before they've been fully copied or moved!

The interviewer shot themselves in the foot, halfway through the (reasonable) list of solutions given by the candidate, they said it was not possible to modify the downloader. However, their simple solution given at the end required a modification of the application they said couldn't be downloaded!

Re: A Problem at the Personal Level & More

2008-09-24 12:07 • by oppeto (unregistered)
219113 in reply to 219089
ST:
Thanks for the interview tales, this is one of my favourite sections. Mind you, I'm pretty shocked at how many of the resident professionals are trying to come up with alternative answers for the problem in the second tale. Obviously you use a temp filename (ignored by the watcher) or a temp directory. What kind of mindset comes up with anything else? Especially consdering that the candidate is being prompted by the interviewer that he is looking for a simple solution. I don't think they lost any worthwhile talent by turning down that hire.

Start with the assumption that you can modify the watcher, but not the downloader (exactly like here at my workplace, actually)... check the file size, wait a minute, check again, only process if the size is the same. Not foolproof, but "good enough" and doable in a small shell script.

Re: A Problem at the Personal Level & More

2008-09-24 12:13 • by Not Worthy (unregistered)
219115 in reply to 219083
my first thought is to write a third program that also checks the remote site, and alters file permissions on the downloads-in-progress so the Watcher can't access them until the download is finished.


THANK YOU! Seriously, the problem states that the Downloader downloads to a particular directory, and the official solution is "just change that directory". Even the official solution violates the terms of the problem.

Seriously, run the watcher and downloader as different users. If the directory has the right permissions and the right umasks are in place, the watcher cannot even see the files which the downloader downloads until something (maybe a third process, but preferably the downloader) changes the permissions on the file, say to world-readable. _That's_ the right way to do it.

Re: A Problem at the Personal Level & More

2008-09-24 12:15 • by hatterson
219116 in reply to 219109
SomeCoder:
Yeah, solution #2 is just great. Because we all know that every file system command is guaranteed to be atomic, right?

mv may be CLOSE to atomic but it's definitely not guaranteed to always be atomic. And if we suddenly have to change directories across partitions then it damn well is NOT atomic.

I think Jeremy H should get a better interview question.


Actually I believe that if you stick within the same volume it is guaranteed to be atomic. Given that you can modify the downloader it's fairly simple to have the tmp location on the same volume as the final location

Re: A Problem at the Personal Level & More

2008-09-24 12:15 • by Branan (unregistered)
219117 in reply to 219057
A file move is different from a file copy in Linux. A move involves changing one pointer in the filesystem, no information is actually "moved". So it's not actually a problem.

Re: A Problem at the Personal Level & More

2008-09-24 12:19 • by AMerrickanGirl
The first story about the interviewer going out to lunch reminded me of a somewhat similar experience.

I was contacted by a recruiter who asserted that he had a couple of jobs that were perfect for me. But first, he insisted on meeting me in person.

His office was 40 miles away, but I agreed to be there at 9 am.

I arrived there at 9 am. He wasn't there yet. They put me in a small windowless room and asked me to wait.

Twenty minutes later I wandered out to find someone and ask what was going on. They didn't know why Recruiter Guy wasn't in yet, but they sent out his cube mate, another recruiter, to talk to me. Problem was, she didn't have any of my information available to her so it was kind of a waste of time.

Another twenty minutes went by and someone finally called Recruiter Guy. He was stuck in traffic, with a cell phone that worked perfectly, since they got through on the first try, but he hadn't bothered to call his office to tell them to make nice to the 9 am interview that he was going to be very late for.

They had the nerve to ask me if I would wait another 40 minutes for him to arrive. I said no thanks and walked out. If he had made the effort to call his office and apologize to me for being late, I would have waited. But he could have cared less, so he wasn't getting any commission off my back.

Mis-directing question

2008-09-24 12:19 • by Chris (unregistered)
I think the problem with the downloader/watcher question is actually in the wording of the question, which serves to misdirect the candidate.

It is phrased thusly: "Every night, a Downloader program will... save them to a certain directory on disk. A Watcher program monitors this directory"

The clear implication is that the Watcher watches the download directory. This would probably give the candidate a fairer shot:

"Every night, a Downloader program will... save them to disk. A Watcher program monitors a certain directory


Re: A Problem at the Personal Level & More

2008-09-24 12:20 • by persto (unregistered)
219120 in reply to 219111
Paul:
re: File watcher.

Ignoring the fact that several people have raised that files appear before they've been fully copied or moved!
For moves within a filesystem (renames), this *does* *not* happen. That's why it's called "rename", you're taking a file that *already* *exists*, and just pointing a new name at it. It is essentially a pointer assignment, "inode *file; ...; dir_ent.target = file".

The interviewer shot themselves in the foot, halfway through the (reasonable) list of solutions given by the candidate, they said it was not possible to modify the downloader. However, their simple solution given at the end required a modification of the application they said couldn't be downloaded!

Read again... the said not to modify the *watcher*.

Re: A Problem at the Personal Level & More

2008-09-24 12:28 • by mauhiz (unregistered)
I don't know what I am missing there, why not just wait for the Downloader to finish its job?

a script would look like this :

Downloader && Watcher

I don't think having a daemon poll a directory is a good practice anyways...

Re: A Problem at the Personal Level & More

2008-09-24 12:30 • by fruey
219123 in reply to 219118
AMerrickanGirl:
The first story about the interviewer going out to lunch reminded me of a somewhat similar experience.

I was contacted by a recruiter who asserted that he had a couple of jobs that were perfect for me. But first, he insisted on meeting me in person.

His office was 40 miles away, but I agreed to be there at 9 am.

I arrived there at 9 am. He wasn't there yet. They put me in a small windowless room and asked me to wait.

Twenty minutes later I wandered out to find someone and ask what was going on. They didn't know why Recruiter Guy wasn't in yet, but they sent out his cube mate, another recruiter, to talk to me. Problem was, she didn't have any of my information available to her so it was kind of a waste of time.

Another twenty minutes went by and someone finally called Recruiter Guy. He was stuck in traffic, with a cell phone that worked perfectly, since they got through on the first try, but he hadn't bothered to call his office to tell them to make nice to the 9 am interview that he was going to be very late for.

They had the nerve to ask me if I would wait another 40 minutes for him to arrive. I said no thanks and walked out. If he had made the effort to call his office and apologize to me for being late, I would have waited. But he could have cared less, so he wasn't getting any commission off my back.


I worked for a boss who was always late. He hated me from when I told him that being late showed an absolute disrespect for the value of other people's time.

Funnily enough, he left soon afterwards...

Re: A Problem at the Personal Level & More

2008-09-24 12:37 • by Brandon (unregistered)
219125 in reply to 219052
Alan:
“Oh,” he scoffed, “so, we’re equals now, is that it?”

No. I'm not an asshole. Good day.


And then when he starts to come back with some witty remark you interrupt him with, "I said GOOD DAY!"

Re: A Problem at the Personal Level & More

2008-09-24 12:39 • by Marc (unregistered)
You could build custom FPGA that intercepts packets on the the network and copies them to flash memory. The hardware can use a serial interface to indicate when the download is complete to a third program, 'The Mounter', which mounts the flash disk to the location the Watcher is expecting.

The hardware can have a pool of flash memory disk areas, one being written to from the network, one mounted. Each flash memory area would only hold one file at a time.

Since the Watcher is always running, I'm assuming it uses some sort of event handling system. An operating system hook to the event which indicated the Watcher is done processing and is now watching could be used to tell 'The Mounter' when its time to unmount a flash disk and mount the next one in the queue.

Re: A Problem at the Personal Level & More

2008-09-24 12:40 • by AnonymousInterviewer (unregistered)
The problem with the bad recruiter is hardly a joke for me. I have faced this on numerous instances where we were looking for candidates. I felt they were resorting to corrupt HR practices, like nepotism. Ofcourse, I have never been able to gather any substantial evidence to file a formal complaint with HR.

The only time I came close to nailing them down was when I got so frustrated with them that I posted a job on a local bulletin board, totally bypassing them. I got more responses from good local candidates in about 6 hours than I got from them in 2 weeks. Of course, there was no way I could proceed with this because my action (bypassing them) itself was in violation of HR policy.

This proof was enough for me to quit the company. I don't think this practice has changed, though. BTW, I'm talking about a large corporation, here - a big name in software.
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7 | Page 8Next »

Add Comment