files

Delete hidden files in Ruby

Does anyone know how to delete all files in a directory with Ruby. My script works well when there are no hidden files but when there are (i.e .svn files) I cannot delete them and Ruby raises the Errno::ENOTEMPTY error. How do I do that ?? Thanks in advance. ...

Locking and unlocking files using the java API

One of our clients is using some Novel security software that sometimes locks some .class files that our software creates. This causes some nasty problems for them when this occurs and I am trying to research a workaround that we could add to our error handling to address this problem when it comes up. I am wondering are there any call...

python: delete non-empty dir

How do I delete a possibly non-empty dir in Python. The directory may have nested subdirectories many levels deep. ...

Custom Prefetch

Any programmatic techniques, portable or specific to NT and Linux that get the result of number of large files loading faster? I am after a 'ahead of time', a priori, whatever you prefer to call it mechanisms that I can control in code for two OS-es in question. Each file has to be processed in full, ie. completely in size and sequenti...

Properties file in Eclipse

I have an application that uses a properties file that was added by hand at the /project/bin folder (Eclipse project). The application locates the file using: this.getClass().getClassLoader().getResourceAsStream("filename.properties") Now I want to add this file in Eclipse, so it's actually part of the project. In which directory shou...

Can I web-serve a document from one place and its content-type from another?

Hi, I am trying to write a web application that will serve uploaded files, and let the uploader specify the content type. For this to work, I need to be able to control the content-type when I serve the file. With most web-servers I'm aware of (e.g. Apache), the best I can do in that respect is set an appropriate suffix and hope that no...

Delphi - get what files are opened by an application

How can I get the list of opened files by an application, using Delphi? For example what files are opened by winword.exe ...

Variables magic and read from file

Assume, i got the following file (input.txt): name = "Peter" age = 26 family_status = married Mentioned lines can be stored in a random order, lie: family_status = married name = "Peter" age = 26 In my program I also have variables family_status, age and name. How do I in a single cycle read those lines from file and assign corresp...

In IE, opening MS Office files asks for a certificate and then shows blank page

When I try to open MS Office files on my website I first get a popup that says "The website you want to view requests identification. Please choose a certificate" I have "Ignore Client Certificates" checked, and the only other answer I've seen involves playing with the registry which I'd like to avoid. Even more annoyingly, if I click ...

How to best organize files

Often, when doing a process or storing files I typically try to work with a workflow, or system. For instance, when I download a file, I sort it within a folder Programming/Downloads/Templates/ or Libraries, etc., and when I start a project I create a new folder for it within a workspace folder. This works fine, unless I need slightly ...

Combining Audio Files as One Properly on iPhone with NSData

I am using AVAudioRecorder to save an audio file every 15 seconds by stopping the recording appending that data to the previously recorder file using a NSMutableData object and using the appendData method. I then record again in the same method so the recording is "continuous". The problem is as soon as you do [recorder stop] it saves...

Why is fwrite writing more than I tell it to?

FILE *out=fopen64("text.txt","w+"); unsigned int write; char *outbuf=new char[write]; //fill outbuf printf("%i\n",ftello64(out)); fwrite(outbuf,sizeof(char),write,out); printf("%i\n",write); printf("%i\n",ftello64(out)); output: 0 25755 25868 what is going on? write is set to 25755, and I tell fwrite to write that many bytes to a fi...

Converting audio and video to NSData

I would like to confirm what the recommended ways are to convert audio and video files into NSData objects. Is + dataWithContentsOfFile: the best way to do this? Thank you ...

How do I explain my colleagues that filenames should not contain uppercase characters or special characters?

For what I know, it's best practice to name files like this: file_name.txt - or if you want to file-name.txt. Now some people seem to like to name their files fileName.txt or FILENAME.TXT or "File Name.txt" - how do explain them that it's not a good idea? Why exactly is the aforementioned file naming best practice? I only vaguely know ...

How to remove duplicate paragraphs in multiple files?

I have two sets of files with newspaper articles in them; about 20 files with about 2000 articles, and 1 file with about 100 articles. The 100 articles in the single file should be disjoint from the others, but are in fact duplicated randomly throughout the 20 files (once each). Any ideas for an easy way to find and remove the 100 dupl...

File written by old C code, moved to C#

I'm working on converting an old C program (currently run on UNIX) into our C# system. The program builds some data into several structs and then writes a file using a series of fwrites like this: fwrite ( &loc, sizeof ( struct loc_items ), 1, hdata.fp ); With loc being the data, struct loc_items being the struct it's a type of. M...

How to share files in a depot

We are using Perforce. In the depot are some projects that have their own main/branches/releases sub folders. There are also some resource files (png, mp3 and so on) that are needed (shared) for some of the different projects. Those don't have the main/branches/structure. Currently they are stored in a seperat folder in the depot that is...

adding multimedia files in a database

how to add multimedia files(such as images) in a database(SQL SERVER or ORACLE) ...

What files do I need to include with my Python app?

I have an app that uses the python/c api and I was wondering what files I need to distribute with it? The app runs on Windows and links with libpython31.a Are there any other files? I tried the app on a seperate Win2k system and it said that python31.dll was needed so theres at least one. Edit - My app is written in C++ and uses the Pyt...

Can a program delete its own executable

Is there any way that a running process can delete its own executable? For example, I make a console application (single exe) and after doing some tasks it somehow deletes the exe file. I have to send a single file to someone. And I want it deleted after it does its intended task. Is there anyway to do it in Windows ...