streams

Are there any benefits to using HtmlTextWriter if you are not going to benefit from adaptive rendering?

Outside of benefiting from Adaptive Rendering for alternate devices, does it ever make sense to write all of this code: writer.WriteBeginTag("table"); writer.WriteBeginTag("tr"); writer.WriteBeginTag("td"); writer.Write(HtmlTextWriter.TagRightChar); writer.WriteEncodedText(someTextVariable); writer.WriteEndTag("td"); writer.WriteEndTag(...

Inherited Stream; buffering in Read()

Hello, I have inherited Stream class, in which I don't know how to implement Read() function properly, so I won't end up with a lot of nested ifs and hard to debug code. The point is that reading from source of this stream returns constant sized buffer (e.g. not changeable), but Read() function accepts different buffer sizes. I though of...

C# Stream text/data to zip/gpg instead of passing app a filename?

I currently have an app written in C# that can take a file and encrypt it using gpg.exe What I'm trying to do is, instead of 1. Creating a file (from database queries usually) 2. encrypting the file 3. deleting the non-encrypted file I want to Gather info into memory (into a dictionary or a list or whatever) stream the text/d...

Table layout using std::cout

How do I format my output in C++ streams to print fixed width left-aligned tables? Something like printf("%-14.3f%-14.3f\n", 12345.12345, 12345.12345); poducing 12345.123 12345.123 ...

Does the .NET Streams save memory?

Example: If I read a file and copy it to another file through .NET Streams will the total size of the file occupy the memory at any moment? Or will the bytes be discarded as soon as they are used? If the naive approach doesn't saves memory would buffered Streams do it? ...

Get the amount of bytes read in by javax.xml.stream.XMLStreamReader

Is there any way to get the amount of bytes read in by the XMLStreamReader, I am using a java.io.FileReader which is passed into the factory that creates the xml reader. I'm doubting this is possible with the XMLStreamReader but any work around is great. ...

istringstream "get" method implementation

The "method" implementation says istringstream get int get(); Extracts a character from the stream and returns its value (casted to an integer). I wanted to see its implementation. Edit:Removed the part which I am trying to port ...

Implement istream get for a character buffer?

I want to implement the following have a character buffer and the code I am trying to port puts this character buffer in a stream and then does a get like this char *buffer; //this is initialized int bufferSize; //this is initlized std::istringstream inputStream (std::string(buffer, bufferSize)); int getVal = inputStream.get(); E...

C++ reading unsigned char from file stream

I want to read unsigned bytes from a binary file. So I wrote the following code. #include <iostream> #include <fstream> #include <vector> #include <istream> std::string filename("file"); size_t bytesAvailable = 128; size_t toRead = 128; std::basic_ifstream<unsigned char> inf(filename.c_str(), std::ios_base::in | std::ios_base::binary)...

Simplest way to output XML from SQL Server to client

I need to return contents of an xml column in sql server to client by simply clicking a URL. The xml has processing instruction to open the correct application (Infopath in this case). I'm a bit confused as to all the various xmlreader writers and streams available. I suppose I want to send the contents of SQLs ExecuteXmlReader to Resp...

"Parameter not valid" exception loading System.Drawing.Image

Hi i am getting the same exception "Parameter not valid" in my code MemoryStream ms = new MemoryStream(byteArrayIn); System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms); Actually the byteArrayIn 's length is 169014. And none of value in it is not greater than 255. But i am getting this exception. So my question is ...

Streams in C#

I wanted to know how streams work internally in c#. Does StreamReader and StreamWriter use recv() and send() functions of Winsock internally. I also wanted to know the difference between streams and channels. ...

Creating a PHP file that downloads all links from a certain site

I recently installed the add-on "DownThemAll" into my firefox and as I watched it download a huge amount of pk3 files(map files for an opensource First Person Shooter), I wondered if I could do the same with PHP. Here's what I'm thinking: foreach(glob("http://www.someaddress.ext/path/*.pk3") as $link) { //do something to download... ...

How to debug a weird threaded open fifo issue?

A web service is configured to expose some of its data when receiving a USR1 signal. The signal will be sent by a xinetd server when it receives a request from a remote client, e.g. nc myserver 50666. When the web server receives USR1 signal, it opens a dedicated fifo pipe, writes its data to the pipe, and then close the pipe. In the mea...

Using boost::iostreams::tee_device?

Can someone help me? I am trying to do something like the following: #include <boost/iostreams/tee.hpp> #include <boost/iostreams/stream.hpp> #include <sstream> #include <cassert> namespace io = boost::iostreams; typedef io::stream<io::tee_device<std::stringstream, std::stringstream> > Tee; std::stringstream ss1, ss2; Tee my_split...

What does "The .NET framework uses the UTF-16 encoding standard by default" mean?

My study guide (for 70-536 exam) says this twice in the text and encoding chapter, which is right after the IO chapter. All the examples so far are to do with simple file access using FileStream and StreamWriter. It aslo says stuff like "If you don't know what encoding to use when you create a file, don't specify one and .NET will use ...

How to print an entire istream to standard out and string

How do you print an istream variable to standard out. [EDIT] I am trying to debug a scenario wherein I need to ouput an istream to a log file ...

Can you use javascript to render an image stream?

The situation is that you have to work with an image API and you have to make a POST request to get an image stream that you want to display in the rest of your web page. I can make an ajax request to that service on page load using jQuery, but i just get a binary stream returned. Is there anyway that JavaScript can take that binary st...

Question about Socket Streams on iPhone

I want to send a UIImage to a server with socket. I'm using this code from ADC: - (IBAction)searchForSite:(id)sender { NSString *urlStr = [sender stringValue]; if (![urlStr isEqualToString:@""]) { [searchField setEnabled:NO]; NSURL *website = [NSURL URLWithString:urlStr]; if (!website) { ...

How to add data for NSOutputStream?

I want to convert a UIImage to an NSOutputStream and send it to a server through socket. #import "Connection.h" @implementation Connection -(void) open: (NSString *) h : (int) p { strHost = h; intPort = p; [NSStream getStreamsToHost:objHost port:intPort inputStream: [receiveStream retain]; [sendStr...