file

Java isn't deleting a file

Java isn't deleting a file. I made sure it has permissions (full control to everyone, or 777 for you Unix-ers.) The System.out.println(currArchive.delete()) always returns false. Does anyone know why? I tried wrapping it with a try-catch security exception but it wasn't thrown. help? I made sure all my streams were closed, but it still r...

Render file Rails3

I'm trying to render a png file in a controller in Rails3. I'm using: render :file=>'public/images/filename.png' However, the output seems not to be a PNG file (its contents start with "PNG" -checked it with curl- but it's not a valid file). I cannot find documentation on render :file in Rails3. Has the syntax changed for this? Even i...

Reading file using python and and see if a particular string is there inthe file.

I have a file in the following format Summary;None;Description;Emails\nDarlene\nGregory Murphy\nDr. Ingram\n;DateStart;20100615T111500;DateEnd;20100615T121500;Time;20100805T084547Z Summary;Presence tech in smart energy management;Description;;DateStart;20100628T130000;DateEnd;20100628T133000;Time;20100628T055408Z Summary;meeting;Descrip...

php script to write files and create zip file

Hi I'm trying to develop an online formbuilder. Each user can build their own forms and I want to be able to provide a button that when clicked will download the users html form page along with its css file as a zip file. I know how to zip the files, but my problem is that the main users html form page doesnt exist as seperate file, it...

How to replace a js file path in my php page using PHP?

How to edit js/swf file path in my php page using PHP code. Path is not unique it is varying. I have to search these file path and replace it. Any body knows the solutions please help me. ...

php file_get_contents errors

Hi I'm using the following code: to write contents from one file to another $page = file_get_contents('myPage.php?id='.$_GET['id']); $file = 'temp/form_'.$_GET['id'].'.html'; file_put_contents($page, $file); But I keep getting the following errors Warning: file_get_contents(myPage.php?id=9) [function.file-get-contents]: Invalid...

How to prevent my C# application from opening the same file twice

Possible Duplicate: How to check For File Lock in C# ? I need to know when a text file that's opened by C# is not in use anymore - My app writes text to a txt file and sometimes it will still have a lock on it when trying to write to it again. There is no concern that another process or word may grab the lock back after it is...

Temporary file, single instance lock, and process kill (Java)

I'm currently using a temp folder for my Java application to create a lock so that only one instance can be running at a time. This lock file MUST be deleted when the program exits. This is fine, except for the case when the process is killed (not allowed to shutdown normally, e.g. from Windows Task Manager). If that happens, the user ...

Python/Django download Image from URL, modify, and save to ImageField

Hi all, I've been looking for a way to download an image from a URL, preform some image manipulations (resize) actions on it, and then save it to a django ImageField. Using the two great posts (linked below), I have been able to download and save an image to an ImageField. However, I've been having some trouble manipulating the file ...

Having several file pointers open simultaneaously alright?

I'm reading from certain offsets in several hundred and possibly thousands files. Because I need only certain data from certain offsets at that particular time, I must either keep the file handle open for later use OR I can write the parts I need into seperate files. I figured keeping all these file handles open rather than doing a sign...

Can Perl's CGI.pm process Firefox's <input type="file", multiple=""> form fields?

Firefox 3.6 introduced a [multiple attribute on regular type="file" input elements]( http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/). I cannot get Perl to process these fields. I can call the field in a list context like this: my @files = $CGIobject->param("File_Input"); Looping through that will give me the fi...

File Transfer returns weird characters

So I'm trying to create a simple file transfer method. It's completely working for small files (a few bytes). But if I want to transfer a file with the size of 2 kB, it returns unicode characters instead of that what's inside the file. Server: void DownloadFile(SOCKET Socket){ if(Socket == NULL){ return; } while(1)...

File Redundancy in C

What is meant by "File Redundancy"?? It would also be helpful if a "C Program to detect File Redundancy" be also given. I was asked the above question in an Interview. I didnt know the answer to it since I could not understand what they were asking in the first place. Can anyone help me!!! EDIT : I have rephrased the question. I think...

Python: determining if an object is file-like?

Hi, I'm writing some unit tests (using the unittest module) for my application, and want to write something which can verify that a method I'm calling returns a "file-like" object. Since this isn't a simple isinstance call, I wonder what the best-practice would be for determining this? So, in outline: possible_file = self.dao.get_fil...

Netlogo: line break in output file?? Not so simple.

Dear reader, I tried all options to create a new line in my output file, but still I get a txt-file with everything behind the previous information. Even with this supersimple code: globals [file] to setup clear-all set file "results\GA1.txt" if is-string? file [while [file-exists? file] [set file replace-item (lengt...

(SQL) How do I query for a list of items that share attributes while listing the rows independently?

Hi All, Having a bit of a "special" moment here. Basically I have a DB table for listing files and their attributes (size, creation date, etc). Being a self-proclaimed (borderline delusional) SQL-whiz, you can imagine my surprise when I failed to figure out a quality manner by which to individually list only files whose [INSERT ATTRIB...

File operation in C++

I have written an object to file but when i read the object from the file is not getting the correct value. if 1 object is considered as 1 record if only 1 record is there in the file its getting the value. if i write more record (many object of same type) then its not getting the value. plz help me what to do. ...

Groovy read text file but omit header

This is a follow up to the question asked here: http://stackoverflow.com/questions/3360191/groovy-parsing-text-file The difference now is my file has a header, I attempted to read past the header first and then onto the content that I am wanting, but for some reason it doesn't seem to cooperate. def dataList = [] def theInfoName = 'tes...

Browse a file from my pc using web application in asp.net

Hi, I have a web application which I uploaded using IIS. I want the users using the application would be able to select a file located on their (the user) computer and read its contents. The code is: TextReader trs = new StreamReader(faFile.Value); DataAccessLayer.clearFA(); string line = trs.ReadLine(); ...

Firefox Error Message "filename part could not be saved, because the source file could not be read"

Hi There, This error is discussed in many places on the internet. It's a strange problem as some Firefox installs will work and others won't even if they are the same version. Some Chrome installs don't work either but IE always seems to work. There are a number of discussed solutions; mostly based around cleaning out "corrupt" files fr...