file

Go - How to read/write to file?

I've been trying to learn Go / Golang on my own, but I've been stumped on trying read and write to ordinary files. I can get as far as: inFile,_ := os.Open(INFILE,0,0); but actually getting the content of the file doesn't make sense, since the read function takes a []byte as a parameter?? func (file *File) Read(b []byte) (n int, err E...

knowing a device special file major and minor numbers in linux

Hi! All files in /dev are special files... they represent devices of the computer. They were created with the mknod syscall. My question is: How can I know the minor and major numbers that were used to create this special file? thanks! Manuel ...

File read by interrupt in java

Hi, I am using a text file to store the serial port output. And now I want to put the contents of the file to an textArea in java. I have created a dedicated thread for file read operation. I need the thread to sleep when there is no data to read and thread should wake up automatically once data available for read in the file. In the th...

Directory contents diff

I'm looking for existing ideas / solutions to the problem of finding differences between two directories. Specifically how to identify files that might have been changed, renamed and moved. A short list of things I've considered: try to pair up files missing in dir A with new files in dir b by using some heuristic such as 75% match in...

Create XML file dynamically in Iphone

Hi I want to create a xml file dynamically for my Iphone application. I tried it by using NSXMLDocument but NSXMLDocument is not declared in iphone application. Please help me in doing so. Thanks Gaurav ...

read chunk by chunk bytes from a file in iphone application

hello I am trying to implement an iphone application which can read some fixed amount of bytes from a file and store in another file. this process will going on up to end of file. I am very new to iphone application so please help me on that . Is there any parent classes are there for this specific type of implementations. ...

Split file based on string delimiter in bash.how?

Hello I have this file.csv : coordinate1,coordinate2,value1 11111,a1,65 11111,a2,32 22222,b1,39 22222,b3,55 33333,c5,12 33333,c9,16 coordinate1,coordinate2,value2 54656,a1,65 21342,a2,32 23543,b1,39 123123,b3,55 568568,c5,12 568568,c9,16 123123,b3,55 568568,c5,12 568568,c9,16 coordinate1,coordinate2,value3 23543,b1,39 123123,b3,55 56856...

Suppress linebreak on file.write

When writing to a text file, some of the file.write instances are followed by a linebreak in the output file and others aren't. I don't want linebreaks except where I tell them to occur. Code: for doc,wc in wordcounts.items(): out.write(doc) #this works fine, no linebreak for word in wordlist: if word ...

How can I get all files in a directory, but not in subdirectories, in Perl?

How can I find all the files that match a certain criteria (-M, modification age in days) in a list of directories, but not in their subdirectories? I wanted to use File::Find, but looks like it always goes to the subdirectories too. ...

Rename pdf file to be downloaded on fly

Given: All the uploaded pdf files on server are prefixed with timestamps. Later user can download these files again. These (ugly)filenames would never change again on server. Question: When I give the option to download PDF file, name of the file looks ugly and lengthy. How can I change this name to something sensible, so that when user...

Displaying an XML code in the browser

This may be simple, although i'm having some trouble finding a solution. When you look a .xml file in your folder, you could double click it so your main browser will display the code content of it. I have the complete path of the xml, and I'd like to create a link in aspx (with either c# or vb.net) that redirects to the XML in the bro...

how to find the owner of a file or directory in python

I need a function or method in Python to find the owner of a file or directory? the function should be link find_owner("/home/somedir/somefile") owner3 ...

Is close() necessary when using iterator on a Python file object

Is it bad practice to do the following and not explicitly handle a file object and call its close() method? for line in open('hello.txt'): print line NB - this is for versions of Python that do not yet have the with statement. I ask as the Python documentation seems to recommend this :- f = open("hello.txt") try: for line in...

Download a file from any given URL and save it to my Machine with ASP.NET

Case: I need to feed my application a URL from any location on the internet. At the other end of the URL will be a file of some sorts. A picture/video/document and I need to save this item to my server automatically without a 'save-as' dialog box. This needs to be done in ASP.NET. Im having trouble on how to actually grab that file...

[PHP] Retrieving and writing a file to system

What's the simplest way for me, in PHP, to: Retrieve a file from an external URL (http://test.com/thisfile) If successful, delete local file /root/xml/test.xml Rename downloaded file to test.xml Write new file to /root/xml/ folder This will be a private script, so security or error handling are not important concerns. ...

How to use EOF to run through a text file in C?

Hello, I have a text file that has strings on each line. I want to increment a number for each line in the text file, but when it reaches the end of the file it obviously needs to stop. I've tried doing some research on EOF, but couldn't really understand how to use it properly. I'm assuming I need a while loop, but I'm not sure how to...

Response.TransmitFile problem

I have the following code delivering a file to users when they click on a download link. For security purposes I can't just link directly to the file so this was set up to decode the url and transmit the file. It has been working fine for a while but recently I started having problems where the file will start downloading but there's n...

Can a BFILE locator point to a directory on a different filer?

I have a java web application which needs to upload files and we want to store these files on the filesystem rather than in the database. The database will store the document metadata only. The question is whether to just store the path as a string in Oracle, or as a BFILE locator? Can a BFILE locator point to a location which is on a d...

Visual Studio 2008 project reference

I have a problem with the "Copy to output" functionality in Visual Studio 2008. Maybe I'm misunderstanding how its supposed to work. I have a solution with four projects: TestApp1 (Windows application) TestAppA (Windows application) TestProj1 (Class library) TestProjA (Class library) The dependencies are as follows (dependency as in...

is pwrite after dup race safe?

On Linux pwrite operation (which is seek+write) is atomic, meaning doing pwrite-s in multiple threads with one file descriptor is safe. I want to create file descriptor duplicate, using dup(). Now, having fd1 and fd2 - will pwrite-s work as expected, or there's danger of race condition? ...