stream

Most performant way to write binary data to a file in C#

Hi, I am trying to optimize a class that serializes objects in binary format and writes them in a file. I am currently using a FileStream (in sync mode because of the size of my objects) and a BinaryWriter. Here's what my class looks like: public class MyClass { private readonly BinaryWriter m_binaryWriter; private readonly S...

Decoding Manchester biphase-mark in software (representing a SMPTE timecode audio stream)

I've never had to deal with signal/stream encoding or decoding before, at least not beyond fairly basic protocols like HTTP, so forgive me if I'm making this harder than I should be. Several of the systems we use at work rely on SMPTE timecode to operate, a Manchester biphase-mark system that occupies 1kHz of bandwidth between 1kHz and ...

Custom C++ manipulator problem

Hi guys, I'm trying to implement my own stream manipulator inside my logging class. It's basically endline manipulator which changes state of a flag. However when I try to use it, I'll get: ftypes.cpp:57: error: no match for ‘operator<<’ in ‘log->Log::debug() << log->Log::endl’ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/...

Creating a FILE * stream that results in a string

I'm looking for a way to pass in a FILE * to some function so that the function can write to it with fprintf. This is easy if I want the output to turn up in an actual file on disk, say. But what I'd like instead is to get all the output as a string (char *). The kind of API I'd like is: /** Create a FILE object that will direct writ...

Is it possible to stream to an Android phone with Microsoft Media Server?

Let's say that I have Microsoft Media Server stream (i.e. mms://[some ip address here]). This stream contains both audio and video. Is it possible to stream this to an Android phone? How would I go about doing this? Preferably with video, but if it is an audio stream only that would also be okay. ...

stream_socket_client error in php

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /home/biranchi/public_html/push.php on line 42 Failed to connect 110 I am using the certificate, and the private key $ctx = stream_context_create(); stream_context_set_option($ctx, '...

How do I modify PDF without a library using C# and stream it back to client in ASP.NET?

I'm having an issue where I'm corrupted a PDF and not sure of a proper solution. I've seen several posts on people trying to just do a basic stream or trying to modify the file with a third party library. This is how my situation differs... I have all the web pieces in place to get me the PDF streamed back and it works fine until I tr...

If I check stream for valid image I can't write bytes to server

Hi. I am trying to check if a file is an image before I upload it to the image server. I am doing it with the following function, which works exceptionally well: static bool IsValidImage(Stream imageStream) { bool isValid = false; try { // Read the image ...

Capture bitstream into string

I'll need to capture my bitstream into a string and keep concatenating the string. However, I'm not really sure how it's to be done. Any ideas? #include <bitset> #include <iostream> #include <string> using namespace std; int main () { int i; char data[30]; int int_arr[30]; printf("\nEnter the Data Bits to be transmitted :...

How to stream the contents of a file live to a browser

Hiya, I'm trying to find a efficient way to watch the server log on a webpage, i don't mind building an app i just can't work out the best way to do it. Is there a way to keep a stream open to a file with php and to the browser? or will it have to be done by polling the file every x seconds? Thanks in advance, Shadi ...

Display a file from a byte[] or stream

I've got a winforms app that stores the contents of files in a database. The stored files can be of just about any type (word, excel, PDF, text, image ...) the user can select just about any type of file to load. The user can then query the database, find a file and then open it. I've got no problems extracting the byte array from the ...

How to put pointer in the desired place in a stream using PHP?

Hello! Currently I'm making data parser via Telnet connection using PHP. I've encountered problem: I need to put pointer in a stream to the certain place(not to the end of data), but using of fseek() function is impossible with streams. Tell me, please, how can I solve this problem? ...

java null pointer exception

hi, I'm getting java.lang.NullPointerException at while ((len = in.read(buf , 0 , buf.length)) >= 0) in following method: public void copy(String src, File dst) throws IOException { InputStream in = getClass().getResourceAsStream(src); OutputStream out = new FileOutputStream(dst); byte[] buf = new byte[1012]; ...

Spreadsheetgear.IWorkbook/workbook object. How Do I retrieve the length of the workbok?

Dear Stackoverflow community. Development Platform: .NET 2.0 Platform: ASP.NET Spreadsheetgear: 2008 Language: C# Is there a way to retrieve the Length in bytes of a workbook without copying it/saving it to another object? I went through the documentation and several attempts with no success. I am saving the workbook by using the Sav...

Public stream to facebook's user wall with php ?

I build a facebook app with php api, everything work fine just have a problem when i need public a message on user's Wall. my code bellow $appapikey = "xxxxxx"; $appsecret = "xxxxxx"; $facebook = new Facebook($appapikey, $appsecret); $fb_user = $facebook->require_login(); if (!$facebook->api_client->users_hasAppPermission("publish_str...

C# - Stream a PDF using Response.TransmitFile() or Response.WriteFile() And then select a page

I want to stream a pdf from a directory on the server using an ASP.NET page. This works fine. The catch is that I want to pass Adobe Open Parameters to land on a specific page. Adobe has parameters for this: http://url/filename.pdf#page=XX But, I can't find out how to stream the file rather than call it through a URL and get the #page=...

Understanding Streams and their lifetime (Flush, Dispose, Close)

Note: I've read the following two questions already: Can you explain the concept of streams? C# using streams I'm coding in C# In almost all code samples that use streams, .Dispose(), .Flush(), .Close() are almost always called. In the concept of a stream, what does accomplish? If I don't dispose a stream that I stored in a variabl...

Facebook - Stream.publish

I want to programmatically publish messages to my site user's facebook page on their behalf, whenever certain events are triggered from my site. I'll have a cron that executes stream.publish when needed. I am looking at stream.publish to accomplish this, which requires extended permission from the facebook user. Since the user will not ...

how to generate a stream from a string ?

I need to write a unit test for a method that takes a stream which comes from a txt file, I would like to do do something like this: Stream s = GenerateStreamFromString("a,b \n c,d"); ...

Using Python, how do I to read/write data in memory like I would with a file?

I'm used to C++, and I build my data handling classes/functions to handle stream objects instead of files. I'd like to know how I might modify the following code, so that it can handle a stream of binary data in memory, rather than a file handle. def get_count(self): curr = self.file.tell() self.file.seek(0, 0) count, = stru...