file

Creating big file on Windows

Hi, I need to create big relatively big (1-8 GB) files. What is the fastest way to do so on Windows using C or C++ ? I need to create them on the fly and the speed is really an issue. File will be used for storage emulation i.e will be access randomly in different offsets and i need that all storage will be preallocate but not initia...

Fast read/write from file in delphi

I am loading a file into a array in binary form this seems to take a while is there a better faster more efficent way to do this. i am using a similar method for writing back to the file. procedure openfile(fname:string); var myfile: file; filesizevalue,i:integer; begin assignfile(myfile,fname); filesizevalue:=GetFileSize(fn...

Android : Getting file name from camera?

I have run into a small issue with something that I am probably just overlooking. I want to take a picture from the surface preview of the camera, and save it to the sd_card. This works ALMOST perfectly. I assign it a file name, and for one reason or another, it does not use the filename. This is what I have been trying to do : B...

Icons from remote files

I have started coding an FTP client application (for fun). I’m trying to represent remotely hosted files with icons. For example, let’s say I’m browsing the root folder of an FTP server (/) and want to display the Backup.zip file with the icon association from that client operating system. On some systems, this may be the windows comp...

How to explicity tell SVN to treat a file as text, not binary

I have a number of files that I checked into SVN without having set up their Mime types correctly. SVN initially classified them as binary. I've since set their Mime type in SVN via propset to "text/plain; charset=UTF-8" and I'vc made sure that all the files are UTF-8 signed. When I do 'svn blame filename', svn says that the file is b...

How to change the file's permission and last modified in Java?

To my knowledge, Java's File class does not support to change the file's permission and last modified date. Is there any proper way to do this in a cross-platform style? ...

How to create a customized file descriptor on linux

I would like to create a file whose descriptor would have some customizable behavior. In particular, I'd like to create a file descriptor, which, when written to, would prefix every line, with name of the process and pid (and maybe time), but I can imagine it can be useful to do other things. I don't want to alter the writing program - ...

How to ensure file integrity on file write failures?

Follow up to: How to safely update a file that has many readers and one writer? In my previous questions, I figured out that you can use FileChannel's lock to ensure an ordering on reads and writes. But how do you handle the case if the writer fails mid-write (say the JVM crashes)? This basic algorithm would look like, WRITER: lock...

What's the best way to cache data in a C# dll?

I've written a DLL that may be used in a number of ways (referenced by ASP.NET web sites, WinForms, etc.). It needs to load its data from several delimited files that will be automatically updated on a semi-regular basis. For performance reasons, I'm loading the data into a static object (a generic List), and only want to go back to th...

Creating a new file using an existing file within a jar

Let's say I have a file called test.txt within the package "com.test.io" within my jar. How would I go about writing a class which retrieves this text file and then copies the contents to a new file on the file system? ...

How to change file permissions from Java 1.4.2 ?

Hi all, I'm looking for a code fragment, using which I must be to change the file permissions on unix. My project runs on java 1.4.2 .. just a sample code example or methods which needs to be used will do.. Regards, Senny ...

How can I have somehing like the html file button to browser in file in JAVA swing?

I am trying to create my first UI page though Swing. In this page I wish to browse for a file. Can someone please help me achieve this? ...

<input type="file" /> opens file browse window in FireFox3 when clicking the form field part?

When clicking on the text box part of an <input type="file" /> in FireFox3, a file browsing window opens. This doesn't happen in IE7. You have to click the "browse" button to open the file browsing window. How can I prevent the file browsing window from opening in FireFox when a user clicks on the textbox area? I'd like it so it only...

Tracking file load progress in Python

A lot of modules I use import entire files into memory or trickle a file's contents in while they process it. I'm wondering if there's any way to track this sort of loading progress? Possibly a wrapper class that takes a callback? ...

Detecting changes to an open file

Suppose I have an open file. How can I detect when the file is changed by another program in the background. Some text editors can detect and update the open file if it is changed by another process. I'm specifically asking for this with C under Linux(this seems to be OS dependent). ...

Guaranteed file deletion upon program termination (C/C++)

Win32's CreateFile has FILE_FLAG_DELETE_ON_CLOSE, but I'm on Linux. I want to open a temporary file which will always be deleted upon program termination. I could understand that in the case of a program crash it may not be practical to guarantee this, but in any other case I'd like it to work. I know about RAII. I know about signals...

Clear file cache to repeat performance testing

What tools are available to either completely clear, or selectively remove cached information about file and directory contents? The application that I'm developing is a specialised compression utility, and is expected to do a lot of work reading and writing files that the operating system hasn't touched recently, and whose disk blocks ...

File / Folder monitoring

Hi; What is the best way to monitor disks against file activities. I mean that getting the full file name (c:\temp\abc.txt), action(created/deleted/modified/renamed), and also the user (user1) and process name (notepad.exe) causing the file (multiple delete) activities. I heard about Some APIs and ShellNotifications but could not use t...

J2ME API Hard to Find

Where is the API for J2ME? Why is it more difficult to find J2ME's API than its J2SE counterpart? Typing String and Java 1.6 will immediately present one with the String Javadoc for J2SE 6, but doing a similar thing for J2ME will present one with a specific phone manufacturer's Javadoc. I am particularly looking for javax.microedition.i...

Parsing a file with column data in Python

I have a file that contains the symbol table details.Its in the form of rows and columns. I need to extract first and last column. How can I do that? ...