io

Multithreading on a file open copy and write

Hi, I am new at threads here is the question, I have 3 threads one of them calls a method that writes into a file via File.AppendAllText method, other thread duplicates the text in the same file, and the last thread reads the text from file and print on a label. When I start the threads at the same button click event it gives the error...

Reading in a file from Java GUI error.

With assistance from others, I have a program that allows a user to input their employee name and number and then their hourly wage and their total number of regular hours and overtime hours. The program I need assistance with reads in that file, adds a new field at the bottom, "Gross Pay", and calculates the gross pay from the values fr...

How do I get the InputStream of decompressed data from an InputStream of GZIPed data?

I call a service which returns a gzipped file. I have the data as an InputStream (courtesy of javax.activation.DataHandler.getInputStream();) from the response. What I would like to do is, without writing anything to disk, get an InputStream of the decompressed data in the file that is in the archive. The compressed file in this case i...

Is a Download class a bad candidate for immutability?

I have a class that i use to do downloads. The class is observable and i use it as a swing UI model object too. However it is too slow, both to start (from the http handshaking i presume so not much i can do about it probably) and from synchronized access. The interface of the class is: public File getDownloadedFile() public String get...

aio_write on linux with rtkaio is sometimes long

I'm using async io on linux with rtkaio library. In my tests everything works perfectly, but, in my real application i see that aio_write which is supposed to return very fast, is very slow. It can take more than 100 milis to write a 128KB to a O_DIRECT padded file. Both my test and the application use same I/O size, i check on the same ...

Java: Why isn't my file writing working?

I'm trying to write a file from my Java program, but nothing happens. I'm not getting any exceptions or errors, it's just silently failing. try { File outputFile = new File(args[args.length - 1]); outputFile.delete(); outputFile.createNewFile(); PrintStream output = new PrintStream...

XmlDocument.Save omitting elements

I have the following XML that is built up at runtime using an XmlDocument: <?xml version="1.0" standalone="yes"?> <NewConfig xmlns="http://tempuri.org/NewConfig.xsd"&gt; <SystemReference xmlns=""> <ID>1</ID> <Name>CountryName</Name> </SystemReference> <ClientList xmlns=""> <Type>Private</Type> <!-- elements omitte...

Using Ruby's "ready?" IO method with gets, puts, etc

The standard Ruby library "io/wait" provides a method on IO objects ready? that returns non-nil if there is input available, nil or false otherwise. I know some methods like sysread and syswrite are not safe to use with higher level methods such as gets and read, and wanted to know if ready? was safe to mix with the higher level methods...

C# TCP/IP Client having an IO Exception.

The IO Exception: "Unable to read data from the transport connection: An established connection was aborted by the software in your host machine." The code has been copied from a tutorial and I'm sure that this error has something to do with my own machine. All of my firewalls, ESET and Windows, are off. The clients connect via port 555...

How do I check if a file exists? (Java on Windows)

How can I check whether a file exists, before openinging it for reading in Java? (equivalent of Perl's -e $filename). The only similar question on SO dealt with writing the file and was thus answered using FileWriter which is obviously not applicable here. If possible I'd prefer a real API call returning true/false as opposed to some...

How do I correct this silent failure to write files using Java IO?

I am encountering a strange issue with the commons-io/java-io. Essentially my file creation is failing silently without an exception. FileUtils.writeLines(file, collectionOfStrings); I've looked through the commons code to try and figure why this failing silently, but to me it looks like it should be throwing an exception. (See lines ...

Appending lists from files to a single list in Python

I'm trying to write a function that reads files from a "deferred" directory which contains files that contain lists. Here's what the files in the deferred folder contain: '173378981', '45000', '343434', '3453453', '34534545', '3452342', '234234', '42063008', 'Exempted', '10000' '1000014833', '0', '0', '0', '0', '0', '0', '0', 'Exempted'...

Interrupt driven HD44780 library for an Arduino

I have an HD44780 LCD screen, and I've been using the LiquidCrystal Library provided with the Arduino development package. However, it's not reliable. I noticed some problems with it, and instead of being interrupt driven, it just sleeps as long as the developer thinks the chip should take to execute the operation. From the spec sheets,...

Limit user input through Text I/O (68k Assembly)

I'm writing a program in Assembly (68k) and I'm using Easy68k. I am trying to prompt a user to input a string of characters. However, I must limit the amount of characters accepted. I was told I could do that using task #5, through text I/O, but I could really use an example Thanks! ...

Read contents of a file using a relative path in a Web Application

How can I read the contents of a text file in my Web Application, using a relative path/URL? The files are located in a directory at the root of my application. I don't want to specify the full path to the file I want to access, since my test environment is not an exact mirror of my production environment. ...

Java : Reading in a binary file.

I have an program that allows a user to input their employee name and number and then their hourly wage and their total number of regular hours and overtime hours. Then writes out the data to a binary file. The program I need assistance with reads in that file, adds a new field at the bottom, "Gross Pay", and calculates the gross pay fr...

C++ binary file I/O to/from containers (other than char *) using STL algorithms

I'm attempting a simple test of binary file I/O using the STL copy algorithm to copy data to/from containers and a binary file. See below: 1 #include <iostream> 2 #include <iterator> 3 #include <fstream> 4 #include <vector> 5 #include <algorithm> 6 7 using namespace std; 8 9 typedef std::ostream_iterator<double> oi_t; 10 typed...

Serializing BTree to a file

I'm trying to implement a BTree. I'm pretty much done with the tree and works great for a smaller input which means I've implemented the tree in memory. Now I would like to play with large input for which I've to write the tree to a file. I don't know where to get started. I'm using Java and I haven't done too much of 'disk write' coding...

PipedInputStream - How to avoid "java.io.IOException: Pipe broken"

I have two threads. One of them writes to PipedOutputStream, another one reads from corresponding PipedInputStream. Background is that one thread is downloading some data from remote server and multiplexes it to several other threads through piped streams. The problem is that sometimes (especially when downloading large (>50Mb) files)...

Haskell IO with Numbers

Can anyone help with this exersise? Write a program which asks the user for the base and height of a right angled triangle, calculates its area and prints it to the screen. The interaction should look something like: The base? 3.3 The height? 5.4 The area of that triangle is 8.91 Solved with: getTriArea :: IO Float get...