file

How to lock a file on different application levels?

Here's the scenario: I have a multi threaded java web application which is running inside a servlet container. The application is deployed multiple times inside the servlet container. There are multiple servlet containers running on different servers. Perhaps this graph makes it clear: server1 +- servlet container +- application1 ...

GWT Toolkit: preprocessing files on client side

If there's a way for the client side GWT code to pre-process a file on the client computer? For example, to calculate a checksum of it before submitting the file to the server. ...

"Reliable" file work with .NET

Hi, An application needs a counter, which value to be stored in a text file. Sometimes it happens on very short intervals. This test code rewrites a text file very often (f.e. every 100 milliseconds): int counter = 0; while (true) { WriteToFile(counter); counter++; Thread.Sleep(100); } private void WriteToFile(int counter) { byt...

Audio file tagging (read/write) library?

TagLib seems like a good choice, but I don't use C++ and bindings for other languages are limited. Currently I use the ATL library, but it hasn't been maintained since 2005 and I'm having a hard time doing this myself. So I'm looking for another open source alternative that is actively developed. Do you know of one? ...

File changed listener in Java

I'd like to be notified when a file has been changed in the file system. I have found nothing but a thread that polls the lastModified File property and clearly this solution is not optimal. ...

File and space in Python

I have a file like: <space> <space> line1 <space> column 1 column 2 column 3 ... . . . <space> <space> How to remove this extra spaces? I need to extract the heading which will be on line1. Also, I need to extract column 1, column 2, column 3 etc. At the end of last column content there is '\n'.How to get rid of it ??? H...

How to Read only the last line of a text file in Lua?

I have a program that generates text fiels that can be up to 20 mets in size. Sometimes I only care about the last line in the file, is there a way to read just that line with out wasting memory reading the rest of the file? ...

Java : How to determine the correct charset encoding of a stream

With reference to the following thread: http://stackoverflow.com/questions/498636/java-app-unable-to-read-iso-8859-1-encoded-file-correctly What is the best way to programatically determine the correct charset encoding of an inputstream/file ? I have tried using the following: File in = new File(args[0]); InputStreamReader r = ne...

[c++] How to create a std::ofstream to a temp file?

Okay, mkstemp is the preferred way to create a temp file in POSIX. But it opens the file and returns an int, which is a file descriptor. From that I can only create a FILE*, but not an std::ofstream, which I would prefer in C++. (Apparently, on AIX and some other systems, you can create an std::ofstream from a file descriptor, but my c...

Delphi: Check whether file is in use

I want to write to/delete a file but sometimes I get a crash if the file is in use by another program. How do I check to see whether the file is opened by another process or I can open it for writing? ...

Should I manually set Perl's @ARGV so I can use <> to open, scan, and close files?

I have recently started learning Perl and one of my latest assignments involves searching a bunch of files for a particular string. The user provides the directory name as an argument and the program searches all the files in that directory for the pattern. Using readdir() I have managed to build an array with all the searchable file nam...

.ram audio file player

I would like to play some .ram audio files. Can someone point me to a free player? Thanks. ...

How to overwrite some bytes in the middle of a file with Python ?

I'd like to be able to overwrite some bytes at a given offset in a file using Python. My attempts have failed miserably and resulted : - either in overwriting the bytes at given offset but also truncating the file just after (file mode = "w" or "w+") - or in appending the bytes at the end of the file (file mode = "a" or "a+") Is it...

showing content on the blank screen after downloading a file

I've observed that under certain circumstances, a web browser will navigate to a blank page and then prompt the user to download a file. In my current situation, it's navigating to a URL that generates an Excel file. The download of the file works perfectly, but the user is now stranded on a blank page. There are two things I would li...

PHP error reading remote file

When I try to do a file('http://somewebsite.com') i get an error "URL file-access is disabled in the server configuration" I tried using ini_set('allow_url_fopen', 'On'); but that didn't work. I'm using shared hosting. Any suggestions? All I want to do is read the html source code of a website. ...

Problem writing to a file from webserver

One requirement of a project I'm working on is to export a file to a network share based on certain criteria. When I run the code in visual studio it works just fine but when I deploy it the actions that would initiate saving the file end in failure. the users see an alert with: Could not find file '<full filename...>'. In the web.con...

How to open .ttcn file using C file open functions?

I am working on TTCN-3 (Testing and Test Control Notation) scripting language. I wanted to prepare on guideline checker for this code files. For that I want to read lines of TTCN-3 script file( some thing like file.ttcn ) one by one into a buffer. But for me fopen / sopen / open / fgetc / fscanf are not able to work properly and are not...

How to dynamically get the filename according to extension?

As a follow up to this question .... Now I found the answer for that quesstion by a comment by user j_random_hacker. Here Widnows follows 8.3 file naming standard means turbo c can only read files with name length of 8 characters and extension of 3 characters. So windows will give another name to any file which is not following 8.3 na...

C++ code to find all ip address in a file

Hi, I need to write a program to scan a text file and retrieve all ip addresses (of the format 256.256.256.256) in the file. Can you please help me out? ...

Ant task to check if a file exists?

Is there an ANT Task that would execute a block only if a given file exists? I have the problem that I have a generic ant script that should do some special processing but only if a specific configuration file is present. ...