stream

DataContractSerializer - how can I output the xml to a string (as opposed to a file)

Hi All, I had a quick question regarding the datacontractserializer. Maybe it's more of a stream question. I found a piece of code that writes the xml to a filestream. I basically don't want the file and just need the string output. public static string DataContractSerializeObject<T>(T objectToSerialize) { var fs = new ...

Why doesn't Java properly re-create this image from an InputStream?

I've looked at this every way I can think... The problem is that I end up writing the PERFECT number of bytes, and the files are VERY similar - but some bytes are different. I opened the Java generated file in Scite as well as the original, and even though they are close, they are not the same. Is there any way to fix this? I've tried do...

Incremental Stream Parsing in C++

Hi, I am reading data from a (serial) port using a non-blocking read() function (in C/C++). This means the data comes-in in chunks of undetermined (but reported) sizes (incl. 0) each time I "poll" the port. I then need to parse this "stream" for certain patterns (not XML). My naive implementation concatenates the new string to the pre...

Reading an audiostream in python.

Hi, Amazingly, in bash, you can do $ curl http://mp3.streampower.be/radio1-high.mp3 > test.mp3 with an audiostream and then ^C out, and you will have a working mp3 file, leading me to believe I could have this automated in python, but I can't find how. If i just do file('python.mp3', 'w').write(urllib2.urlopen("http://mp3.streampo...

How to play live mp3 stream in customize protocol?

I hope it is a standard protocol like RTSP so I just need to though the url to JMF but it is not. In C it is easy I am using LAME library. Use first 32 bit to decode the mp3struct then keep reading 70 bytes to decode to 1152 byte wav - Sample rate is fixed in 44.1. Now I need to develop a java player for it. Most of resource is for MP3 f...

How to get the id of the post published in the facebook user's stream

Hi, I'm building an iphone app which uses Facebook connect. I'm using the facebook iphone sdk. I'm able to post messages on to the user's wall. But I want to know the id of the post so that I can retrieve information about that post whenever I wish to. Currently, I'm inherited the FBStreamDialog class and overrode the dialogDidSucceeed ...

What's the clue to make stringstream write binary?

What I'm trying to do is, make the class message serialize and deserialize it's self. Not into or from a file, but into or from a binary sequence as a string or cstring. Message.h: class Message { private: int message_id; int sender_id; std::string sender_data; Message (); public: Message (int id, std::string da...

c++ - How to serialize an object to send over network

I'm trying to serialize objects to send over network through a socket using only STL. I'm not finding a way to keep objects' structure to be deserialized in the other host. I tried converting to string, to char* and I've spent a long time search tutorial, posts in internet and until now I found nothing. Is there a way to do it only with...

Encrypting streaming content onto persistent storage and decrypting it to the stream on iPhone

Hello fellow developers, My app "streams" content (fixed sized files, hence quotation marks) from an HTTP server into a local file. Then there is another component of the app that opens that same file and displays it (plays it). This is done for caching purposes, so that when the same file is requested next time, it will no longer need...

ostream showbase non-present for zero value, and internal doesn't work for HANDLE? Must I fudge it?

PSPS: (a Pre-scripted Post-script) It has just come to mind that a more prescient question would have included the notion of: Is this non-display of "0x"(showbase) for zero-value integers a standard behaviour, or is it just a quirk of my MinGW implementation? It all began on a pleasant Sunday morning... I want to dump some Handles i...

Flowplayer: Play an mp3 from a URL that doesn't end in .mp3

Hi, I'm pretty new to flowplayer and have been trying to get it to play an mp3 where the URL doesn't end with .mp3 but streams mp3 correctly. Could someone please give me some direction? This is how my code looks currently: flowplayer( "player", "flowplayer-3.2.2.swf", { plugins: { ...

How to get rid of padding bytes between data members of a struct

Hi colleagues I have a binary file with "messages" and I am trying to fit the bytes inside the right variable using structs. In my example I used two types of messages: Tmessage and Amessage. #include <iostream> #include <fstream> #include <stdlib.h> #include <string> #include <iomanip> using namespace std; struct Tmessage { un...

Render image or pdf stream from SQL database in asp.net

Hi, I have a table with documents saved some of them in pdf, some of them image. I want to create a web app, to show the images (that can be either pdf, either jpg) in the same control. I can manage to see pdf, if I set the Response.ContentType = "application/pdf" or image if I set "application/jpg". But the problem is that how can I ge...

Twitter stream bounding box - how to cover London/UK

I'm attempting to stream Tweets from the UK as a whole, using Twitters stream API, however I'm having trouble with my bounding box. The LAT/LON pairs I'm using to define a bounding box of the whoe UK(Ire included) is as follows. -9.05, 48.77, 2.19, 58.88 However when I try to use this with the Twitter stream API, it states the follow...

How do i convert a memorystream to text?

I am using a tcpstream and copied the data into memorystream. Now i would like to convert it to a text (UTF-8 encoded). I tried various ways and did flush() but i could not figured it out. I tried using it in combination with StreamReader with no luck (i get a empty string). ...

How do I know when a JEE app is undeployed?

I need to close some streams when my jee app is undeployed to avoid pages of exceptions in the server.log every time I undeploy. The Exceptions say: "Input stream has been finalized or forced closed without being explicitly closed". I know how to close (with the close() method), but I dont know when. finallize() comes too late, @PreDes...

What is an open free to use radio / music streaming service I can access via java

Hey guys. I am looking for a free to use radio or music streaming service which I can access using java. I am making a game and instead of creating our own music - there must be a better alternative and hoping this coughs up with something pretty good. Would be cool to have different music streamed to the game whilst you are playing. ...

Dataset ReadXML method Stream vs. String

I have code that calls the ReadXml method of the DataSet class and passes in a file name ReadXml(strFileName). Occasionally this throws a System.IO.IOException because the file is being used by another process. If I change the code to use the ReadXml(stream) method and pass in a FileStream like this: using(FileStream fs = new FileStre...

Slow performance in reading from stream .NET

I have a monitoring system and I want to save a snapshot from a camera when alarm trigger. I have tried many methods to do that…and it’s all working fine , stream snapshot from the camera then save it as a jpg in the pc…. picture (jpg format,1280*1024,140KB)..That’s fine But my problem is in the application performance... The app need ...

[php] get socket error string when async connect fails

hi all anybody knows if its possible to retrieve some error info (like getsockopt SO_ERROR in C) if an async connect like the following fails btw: im not using the socket extension cause streams provide an ssl wrapper <?php $ctx = stream_context_create(); stream_context_set_params($ctx, array("notification" => "stream_notification_call...