file interview questions
Top file frequently asked interview questions
Is there a standard and reliable way of creating a temporary directory inside a Java application? There's an entry in Sun's issue database, which has a bit of code in the comments, but I wonder if there is a standard solution to be found in one of the usual libraries (Apache Commons etc.)
Source: (StackOverflow)
I've been trying to find a way to write to a file when using Node.js, but with no success. How can I do that?
Source: (StackOverflow)
It has always bothered me that the only way to copy a file in Java involves opening streams, declaring a buffer, reading in one file, looping through it, and writing it out to the other steam. The web is littered with similar, yet still slightly different implementations of this type of solution.
Is there a better way that stays within the bounds of the Java language (meaning does not involve exec-ing OS specific commands)? Perhaps in some reliable open source utility package, that would at least obscure this underlying implementation and provide a one line solution?
Source: (StackOverflow)
What is the simplest way to get the directory that a file is in? I'm using this to set a working directory.
string filename = @"C:\MyDirectory\MyFile.bat";
In this example, I should get "C:\MyDirectory".
Source: (StackOverflow)
I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it.
I tried rm
and get back rm: cannot remove 'foo'
.
I tried rmdir
and got back rmdir: failed to remove 'foo': Directory not empty
I then progressed through rm -f
, rm -rf
and sudo rm -rf
Then I went to find my back-ups.
Is there a way to get rid of the symlink with out throwing away the baby with the bathwater?
Source: (StackOverflow)
In Java, I have text from a text field in a String variable called "text".
How can I save the contents of the "text" variable to a file?
Source: (StackOverflow)
If I open files I created in Windows, the lines all end with ^M
.
How do I delete them all in once?
Source: (StackOverflow)
Possible Duplicate:
How do you determine the size of a file in C?
How can I find out the size of a file? I opened with an application written in C.
I would like to know the size, because I want to put the content of the loaded file into a string, which I alloc using malloc()
. Just writing malloc(10000*sizeof(char));
is IMHO a bad idea.
Source: (StackOverflow)
I have a script that needs to do some stuff based on file creation & modification dates but has to run on Linux & Windows.
What's the best cross-platform way to get file creation & modification date/times in Python?
Source: (StackOverflow)
How can I determine the list of files in a directory from inside my C or C++ code?
I'm not allowed to execute the 'ls'
command and parse the results from within my program.
Source: (StackOverflow)
As a newbie to Django, I am having difficulty making an upload app in Django 1.3. I could not find any up-to-date example/snippets. May someone post a minimal but complete (Model, View, Template) example code to do so?
Source: (StackOverflow)
By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.
Source: (StackOverflow)