stream

problem in Stream.read() method in c#.net

public static void ReadWholeArray (Stream stream, byte[] data) { int offset=0; int remaining = data.Length; while (remaining > 0) { int read = stream.Read(data, offset, remaining); if (read <= 0) throw new EndOfStreamException(String.Format("End of stream reached with {0} bytes left to read", r...

Using Esper, how can I perform dynamic filtering of events?

I am a novice in using the Esper event stream engine in Java. The scenario is that events are coming in as POJOs. They have a field that I want to filter on. The filtered values will change over time. I would prefer to not remove and insert a new statement every time a change occurs. Example: Event is named 'MyEvent', and has the f...

Working on localhost but server returns “Failed to open stream: No such file or directory”

Hello to everyone, I'm a newbie that really needs help, been trying to make this php script work with no luck, when I'm running the site locally it works but after I move the files to the server Im getting the following error, hope someone can help me: Warning: include(/var/chroot/home/content/16/5976816/html/inc/header.php) [function.i...

Convert a Stream to a FileStream in C#

Hi, What is the best method to convert a Stream to a FileStream using C#. The function I am working on has a Stream passed to it containing uploaded data, and I need to be able to perform stream.Read(), stream.Seek() methods which are methods of the FileStream type. A simple cast does not work, so I'm asking here for help. Thanks. ...

Stream audio in wifi network over UDP

Hi all, I have to implement a little software that sends an audio stream between two pc in the same WiFi network.. In little words, I get audio from device like a mic and then I have to transmit this audio in real time.. maybe I'll use Java.. To transmit data trough UDP something like this: //create UDP socket DatagramSocket socket = ...

Recommendations for recording streamed video from IP camera?

As a hobby project, I want to set up an IP security camera to stream to my web server. The streams should be stored on the server, and I want to set up a web application to let me browse through the recorded video - either streaming using Flash or HTML5, or just by downloading chunks of video as video files. Although not very experience...

How to nicely output a list of separated strings ?

Usually, when I had to display a list of separated strings, I was doing something like: using namespace std; vector<string> mylist; // Lets consider it has 3 elements : apple, banana and orange. for (vector<string>::iterator item = mylist.begin(); item != mylist.end(); ++item) { if (item == mylist.begin()) { cout << *item; } ...

Ruby iterator for non-seekable stream

I want to read data records from a non-seekable stream in Ruby. I want to leave it up to the user whether the current record should be skipped or read. Usually you would include Enumerable and provide the necessary methods for it to have an iterator in Ruby, but in my case data can be skipped and only one iteration is possible, so I'm no...

Java XML SAXParser throws NullPointerException on method .parse(InputSource,XMLCommandsHandler)

I get a very misterious NullPointerException when parsing a stream comming from a socket with jdk's javax.xml.parsers.SAXParser. My InputSource is a RecordingInputStream that I created by extending FilterInputStream in order to be able to record in a log file all the data that I receive on the socket before it goes down to the parser. B...

Reading from PackagePart stream does not release memory

In our application, we are reading an XPS file using the System.IO.Packaging.Package class. When we read from a stream of a PackagePart, we can see from the Task Manager that the application's memory consumption rises. However, when the reading is done, the memory consumption doesn't fall back to what it was before reading from the strea...

why doesn't my client read correctly the outputStream sent by the Server?

Hi guys. It's a simple client-server where Server using a BufferedWriter object would send to the Client receiving in the object BufferedReader. When I use OutputStream and PrintWriter for the Server and InputStream and Scanner for the Client it works well. What happens is that the client in Buffered way reads -1 if I'm sending an i...

Loading an image from a stream without keeping the stream open

Hello, Is it possible to use the FromStream method of System.Drawing.Image without having to keep the stream open for the lifetime of the image? I have an application which loads a bunch of toolbar graphics from resource files, using a combination of Image.FromStream and Assembly.GetManifestResourceStream. The problem I'm having is wh...

compressing and decompressing source data gives result different than source data

Hello! In my app I need to Decompress data written by DataContractSerializer to compression Deflate Stream in another app, edit the decompressed data and Compress it again. Decompression works fine, but not for data compressed by me. The problem is that when I do this: byte[] result = Compressor.Compress(Compressor.Decompress(source...

Streaming a pdf through a servlet to a browser

I have yer typical servlet that streams a pdf to a browser. The pdfs are stored on an internal server from which my servlet fetches. If I hit the servlet directly from the browser, the pdf is displayed. If I try the same URL in an <IMG> tag in a web page, ... broken pipe. Any insight on why this should be? As an experiment, I can s...

Capturing console stream input

Hi! I would like to make a console application (c# 3.5) which reads stream input. Like this: dir > MyApplication.exe The app reads each line and outputs something to the console. Which way to go? Thanks ...

Linux - Program Design for Debug - Print STDOUT streams from several programs

Let's say I have 10 programs (in terminals) working in tandem: {p1,p2,p3,...,p10}. It's hard to keep track of all STDOUT debug statements in their respective terminal. I plan to create a GUI to keep track of each STDOUT such that, if I do: -- Click on p1 would "tail" program 1's output. -- Click on p3 would "tail" program 4's output...

How do I concatenate two System.Io.Stream instances into one?

Let's imagine I want to stream three files to a user all in a row, but instead of him handing me a Stream object to push bytes down, I have to hand him a Stream object he'll pull bytes from. I'd like to take my three FileStream objects (or even cleverer, an IEnumerable<Stream>) and return a new ConcatenatedStream object that would pull f...

How to show feedback while streaming large files with WCF

I'm sending large files over WCF and I'm using transferMode="Streamed" in order to get this working, and it is working fine. The thing is sometimes those files are just too big, and I want to give the client some sort of feedback about the progress. Does anybody have a godd solution/idea on how to acomplish this? EDIT: I don't comman...

How to read OutputStreamBitWriter object in Java?

I have the following code: OutputStreamBitWriter writer = new OutputStreamBitWriter(System.out); writer.writeBit(1); If I want to print the value or store it in a String, how do I do that? ...

showing fb publish dialog in graph api

Hello all. I'm using FB.api("/[user_id]/feed") method to publish to a friend's wall. I know I need the publish_stream permission for this, and it works just fine. Problem is it auto-posts the stream on the friend's wall, no FB dialog whatsoever. That means, by facebook terms of service, I have to design my own fb like window, and ask to...