files

can Ruby get the filenames in a folder if they have Unicode characters (on Windows Vista)?

i was writing a script on Windows Vista to move the files in a folder to another hard drive, but found that Ruby 1.8.6 or 1.9 both would get back filenames with Unicode characters in it replaced by "??????" so for example, the filename "Chart for ???????.doc" is returned so the file cannot be moved at all... i used filename.each_byt...

multiple files upload using same input name in django

hello there, i m having trouble in uploading multiple files with same input name: <input type=file name="file"> <input type=file name="file"> <input type=file name="file"> at django side print request.FILES : <MultiValueDict: {u'file': [ <TemporaryUploadedFile: captcha_bg.jpg (image/jpeg)>, <TemporaryUploadedFile: 001_using_git_wi...

Locking files using C++ on Windows

I have a program writing/reading from a file, and I want to lock the file for other instances of my application. How can I do it (in c++ visual studio 2003)? I tried using the _locking() but then also I myself cannot reach the file when trying to read/write (in the same instance). I know there's an option of LockFile() but have no idea ...

How to remove/delete executable files (aka files without extension) only

I have a directory src/ that contain many .cc files and its binary. For example: src/ |_ foo.cc |_ bar.cc |_ qux.cc |_ thehead.hh |_ foo (executable/binary) |_ bar (executable/binary) |_ qux (executable/binary) |_ makefile In reality there are many .cc and executable files. I need to remove those binaries in a glob...

Why would I care about IOExceptions when a file is closed?

I've see this sort of thing in Java code quite often... try { fileStream.close(); } catch (IOException ioe) { /* Ignore. We do not care. */ } Is this reasonable, or cavalier? When would I care that closing a file failed? What are the implications of ignoring this exception? ...

File extention of zlib zipped html page?

What does a zipped html file using zlib (deflate) look like sitting on the server? Does it have a different extension than .html? ...

Reading from file using fgets() causes "Access Violation reading from address..." c++

I'm Using FILE * F opened in _sfopen () I'm reading from the file in while(!feof(f)) and then fgets(str,1024,f) when running reaches the last line it still goes in the while but then when trying to fgets it flies out with an access violation arror (menwhile I just put a try and catch(...) but I know It's not a good solution ) what shou...

Wrap files in one executable package

Hi I'd like to wrap a bunch of files (an .exe a .xml, some images) in 1 executable package. When the user launches this executable package the .exe included in this executable package should run. Is this possible in the first place on the windows platform? What I'm not looking for is a self extracting zip or an installer because both o...

Easiest way to compare two Excel files in Java?

I'm writing a JUnit test for some code that produces an Excel file (which is binary). I have another Excel file that contains my expected output. What's the easiest way to compare the actual file to the expected file? Sure I could write the code myself, but I was wondering if there's an existing method in a trusted third-party library (...

Good Way to Secure File Uploads in PHP

Writing a small app that (among other things) lets users upload a file (like an image, a .doc or a text file) as part of their posting/submission. Our current prototype just dumps the file into /{app_root}/files/, but of course, anyone can get to that even if they are not logged in or using the system. The goal is to only grant access ...

Do DeleteFile() Or CopyFile() throw exceptions?

I use the DeleteFile and CopyFile methods. Do these functions throw exceptions or just set errno and lastError? Do I need to surround this code with try and catch? ...

How to truncate a file in C?

I'm using C to write some data to a file. I want to erase the previous text written in the file in case it was longer than what I'm writing now. I want to decrease the size of file or truncate until the end. How can I do this? ...

Do you know of any open source fileupload servlets that are integrated with the ICAP protocol?

Do you know of any open source fileupload servlets that are integrated with the ICAP protocol? I believe it is important to virus scan user uploaded files prior to writing to disk and would like to leverage this method. ...

ftruncate trunc file in c cannot find this function

I want to truncate the file something like setsizeof() with FILE * I'm developing vs 2003 windows #include <unistd.h> there's no such lib how can I do it freopen() truncates all the data vut doesn't write- getting EINVAL error some help????? ...

Problem on Tag "Filesystem"

For recreational reasons I wrote a PHP class that classifies files with tags instead of in a hierarchical way, the tags are stored in the filename itself in the form of +tag1+tag2+tagN+MD5.EXTENSION and thus I'm stucked with the chars limit (255) imposed by the FS/OS. Here is the class: <?php class TagFS { public $FS = null; f...

Perl: adding input filename to output filename

I wrote a script that reads each file in a directory, does something and outputs results from each input file to two different files, e.g. "outfile1.txt" and "outfile2.txt". I want to be able to link my resulting files to original ones, so how can I add input filename (infile.txt) to the resulting filenames, to get something like this: ...

VBA - How do I remove a file from the recent documents list in excel 2007?

The recent documents feature in Office is really useful, but I moved a file to a new directory and now I can't get Excel to stop hitting me with a "can't find this file" notification whenever I open a workbook. The Excel options seem only to control how many of these "recent documents" are displayed and not how many are actually saved. ...

How do I monitor the lock on a file to see when it is released? [C++]

Hello all, I am looking for a way to create a program in unmanaged c++ that waits until a file is unlocked (as in it is no longer in use) and than does something. I have had no luck locating how to do this, any help would be appreciated! UPDATE: I may have answered my own question, see below and tell me what you think.. UPDATE: All th...

How can I temporarily impersonate a user to open a file?

I would like to temporarily impersonate a domain user account to read in a file on a network drive from an ASP.NET site. I would rather not set up impersonation for the entire site or set up a mapped drive on the server. ...

Renaming a set of files to 001, 002, ... on Linux

I originally had a set of images of the form image_001.jpg, image_002.jpg, ... I went through them and removed several. Now I'd like to rename the leftover files back to image_001.jpg, image_002.jpg, ... Is there a Linux command that will do this neatly? I'm familiar with rename but can't see anything to order file names like this. I'm...