file

how to open a file (ie. .txt file) in C++ (kinda like double clicking it in windows)?

I'm wondering how I can open a file literally in C++ (like double clicking it)? ...

Truncating a file while it's being used (Linux)

I have a process that's writing a lot of data to stdout, which I'm redirecting to a log file. I'd like to limit the size of the file by occasionally copying the current file to a new name and truncating it. My usual techniques of truncating a file, like cp /dev/null file don't work, presumably because the process is using it. Is th...

Get original path from django filefield

My django app accepts two files (in this case a jad and jar combo). Is there a way I can preserve the folders they came from? I need this so I can check later that they came from the same path. (And later on accept a whole load of files and be able to work out which came from the same folder). ...

How can one check to see if a remote file exists using PHP?

The best I could find, an if fclose fopen type thing, makes the page load really slowly. Basically what I'm trying to do is the following: I have a list of websites, and I want to display their favicons next to them. However, if a site doesn't have one, I'd like to replace it with another image rather than display a broken image. Any ...

Replace GString tags in a file

Hello, i've got a word document saved in xml format. In this document, there are some GString Tag like $name. In my groovy code, i load the xml file to replace this GString tag like this: def file = new File ('myDocInXml.xml') def name = 'myName' file.eachLine { line -> println line } But it doesn't works. The G...

Multithreaded file access

I am writing a hex editor program and I was thinking about when a user tries to open a very large file (3GB+). I wouldn't want the user to sit around all day for the whole file to load when it already has some data loaded. So here is my question, would it be possible to have multiple threads read the file (not write) simultaneously, at ...

C++ - Convert FILE* to CHAR*

I found a C++ source file which calculates expressions from a command line argument (argv[1]), however I now want to change it to read a file. double Utvardering(char* s) { srcPos = s; searchToken(); return PlusMinus(); } int main(int argc, char* argv[]) { if (argc > 1) { FILE* fFile = fopen(argv[1], "r"); double Value = Utvard...

Safari input file styling with css?

How does one style a form input field of type 'file' for Safari/Chrome and other Webkit based browsers? Right now, all i get is the 'Choose File' button displayed on top of the usual text type box. I've looked around a bit on Google, but havent really seen anything helpful any help? ...

Signed Java Applet writing to a text file

I want to make an Applet write to a text file. I think have overcome the security problem with my own certificate, but the text file isn't receiving the output. My Applet can be seen at tomrenn.com/fallball, and should ask if you trust the certificate. I'm not sure an Applet can write to a text file within the web hosted contents, so I...

Image not deleted even after file.delete() method!!!

Hi All : I have to send mail along with embedded image. Once the mail has been sent, image in the application server should be deleted immediately. Problem i am facing is, after mail sent the control goes method which contain File file = new File("../bar.jpeg") if(file.exists()){ file.delete(); System.out.println(...

Ruby open-uri file locking

I had an issue where downloading to a local file was locking it until I killed the ruby script. On a hunch, I changed the form of the call and now it doesn't lock the file. Can someone tell me why the second form below doesn't lock the file but the first one does? This form locks the local file: open(ver_local_zip, "w+").write(open(r...

Phing, SVN and local file control

Like most people there comes a time when your localhost layout just doesnt really do it anymore and you find there are files all over the place. This is what I propose doing and I think that maybe im missing something or doing too many steps! Most of my work is with Joomla and oscommerce. My directory structure is as follows -Clients ...

Is there a unique id for files?

I have the question http://stackoverflow.com/questions/990759/how-do-you-track-files-in-smb-with-an-application open and I was woundering whether maybe there are unique id's for files so that I can track when a file/folder is moved. Is there something like this? It can be very debian specific ...

I can't delete a file in java

I'm trying to delete a file, after writing something in it, with FileOutputStream. This is the code I use for writing: private void writeContent(File file, String fileContent) { FileOutputStream to; try { to = new FileOutputStream(file); to.write(fileContent.getBytes()); to.flush(); to.close(); ...

Extracting File Extension in PHP (image upload script)

Can anyone tell me what is wrong with this? The file is renamed using a time stamp but the extension doesn't get extracted and placed in the new name. $filenameext = pathinfo($filename, PATHINFO_EXTENSION); $today = getdate(); $uniqueStr = $today[year]; $uniqueStr .= $today[mon]; $uniqueStr .= $today[wday]; $uni...

Parsing a property file content to HTML

I have a property file( actually 100 or more). This is actually placed in one of the configuration folder so usually not been able to modify very often. So now we came up with an idea that the property file is parsed read and converted into meaningful HTML page .For example : forecast.allow.pattern.overrides = N. This property has 2 ...

Programmatically set name of file to upload in webpage

Is there a way to programmatically set the name of a file to be uploaded from a web page? I suspect that browser security restrictions make this impossible, but I'm hoping someone will prove me wrong. I have a web application that needs to let the administrator upload HTML. The admin selects the HTML file, then the app uploads that fi...

Altering file inside firmware requires new checksum

I have a firmware-file for a picture frame that I want to alter. The purpose of this altering is to make the device display a custom image during boot. I've managed to switch the existing JPEG-file with my own custom file, but it is not possible to flash the device with this new firmware-file. The device complains about an invalid check...

How can I identify a file type from a blob/filestream?

We bought an "off the shelf" application a lonnng time ago that is capable of storing files as a blob within SQL Server. We've noticed that the database has more than doubled in size within the past six months due to more frequent usage of this blob field by one department. As a result, the application has become painfully slow. I'v...

Diff tool which generates documentation?

I have tried Beyond Compare, and it seems to be a good tool. But I haven't found a way to export an overview of the differences. The format of it should be one that most people can reader. Doc, Rtf, Pdf, Html... What I need is to display the differences of two folder. And it would be enough to display which files has been changed. But ...