file

Using istream_iterator and reading from standard input or file

Hi, I'm writing in Microsoft Visual C++ and I'd like my program to either read from standard input or a file using the istream_iterator. Googling the internets hasn't shown how simple I think it must be. So for example, I can write this pretty easily and read from standard input: #include <iostream> #include <string> #include <iterator>...

Python library to detect if a file has changed between different runs?

Suppose I have a program A. I run it, and performs some operation starting from a file foo.txt. Now A terminates. New run of A. It checks if the file foo.txt has changed. If the file has changed, A runs its operation again, otherwise, it quits. Does a library function/external library for this exists ? Of course it can be implemente...

How to create an instance of an uploaded file programmatically in rails

I want to create an instance of "uploaded_file = ActionController::UploadedTempfile" from a File.new("path/to/file"), and then go on to do processing on "uploaded_file" like so: uploaded_file = ActionController::UploadedTempfile.new(File.new "path/to/file"). But for everything to work correctly, I need to set it so that uploaded_file...

cgi-bin directory contents: What else can be stored there, apart from the CGI scripts/executables?

What files should/should not be stored in the cgi-bin folder/directory on a web server? Obviously, executable scripts/files that make up a web application, called from a web browser can be stored there. But is there a common industry opinion about what else can be stored there? Is there a very strong reason why nothing else apart than...

How to use flashpaper in asp.net

hi friends, i want to display swf document via Adobe Flash Paper software in our asp.net web page. can any one describe how i embed flash paper API in .net? ...

How to restrict user access the file on the HTTP Server?

I'm writing a web application that allow user upload their files on the app. The file will be uploaded on the HTTP Server, after the user click the "upload" button. The user can receive the file by getting the file from the path.... ...for example: http://www.demo.com/user/abc/download/the%5Ffile.jpg but I found that all the people can ...

How to replace the last one or two characters of a file with unix tools

I have a hanging comma at the end of a file that I would like to replace with a close square bracket. There may or may not be a newline character at the end of the file as well. How can I replace the one or two characters with the square bracket using common unix tools? ...

Java: How to "trim" a byte array?

So I have some code that reads a certain amount of bytes from a file and returns the resulting byte array (this is basically used for chunking up files to send over the network as (eventually) base64-encoded ascii text). It works fine, except that when the last chunk of the file is generated, it isnt a full chunk. Therefore, the resulti...

C# write multi lines to cs file.

Hello. I googled and found the solution at MSDN. // Compose a string that consists of three lines. string lines = "First line.\r\nSecond line.\r\nThird line."; // Write the string to a file. System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt"); file.WriteLine(lines); file.Close(); How to extend the lines to comp...

python write CD/DVD iso file

I'm making a cross-platform (Windows and OS X) with wxPython that will be compiled to exe later. Is it possible for me to create ISO files for CDs or DVDs in Python to burn a data disc with? Thanks, Chris ...

How to add one line before the last line in C

Hi I am working in C on Unix platform. Please tell me how to append one line before the last line in C. I have used fopen in appending mode but I cant add one line before the last line. I just want to write to the second last line in the file. ...

file reading and writting inside asp.net web application

Hi friends, I have developed a web application in visual studio 2008 its in asp.net c#. i have user a html page and one txt file in that application but both are not inside my application bot are outside so when i try to run the same application in another system i will get error because of that files. i want to include that fil...

how to return a FileResult from a string in asp.net mvc

I need to write an action that will return a FileResult from a string ...

C# file-based services and concurrency issues

I am designing the architecture for a set of WCF services. Due to the nature of the deployment of these services (remotely deployed onto a number of unmanageable systems on client sites, therefore we cannot afford the administrative overhead of database servers), the data store has to be file based (we are leaning quite heavily toward X...

Auto delete all files after x-time

Hi, all, i comeback again with hug questions... maybe someone here can help me... how to auto delete all files under a sub directory after x-time (let say after 24 hours) but that i want without using cronjob command from server or pl just using php code or just visit the page without clicking something and the command auto run, where i...

Storing a million images

I have a project that will generate a huge number of images. Around 1,000,000 for start. They are not large images so I will store them all on one machine at start. How do you recommended on storing these images efficiently? (NTFS file system currently) I am considering a naming scheme... for start all the images will have an incre...

suggestion required related to rewriting and string manipulation

Hi everyone , I had to read from a file and for each data between delimiter i need to remove the white space and i have written the following program in jython When i am trying to rewrite ,its rewriting at the end of source file. filesrc = open('c:/FILE/split_doc.txt','r+') for list in filesrc.readlines(): #split the records by...

WCF Streaming File Transfer

I'm attempting to transfer some files through WCF, but as soon as the method is called from the client, I get the following message: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket ti...

Searching a file in 3 different ways.

I have been writing a program that searches a file in 3 different ways. But firstly, to choose which search program to use is differentiated in the command line. For example in the command line I type: Program 1 search: python file.py 'search_term' 'file-to-be-searched' program 2 search: python file.py -z 'number' 'search_t...

WebBrowser Control - Document.Body.InnerText Problem

Hi All, Can somebody please help me fix my code.? I can't see where I'm going wrong. It just doesn't do what it should be doing. It should read a file line by line (every line contains 1 url), and then foreach url in the string it will visit that url and extract title, url, and body text, and then save it to a file but it just doesn't ...