stream

ostream showbase does not show “0x” for zero value

风格不统一 提交于 2020-01-10 04:53:06
问题 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 in their hex representation, and in a consistant, formatted way. I want a leading 0x and a fixed width , but this is proving to be elusive using the expected stream

MediaElement not playing audio from stream WP7

有些话、适合烂在心里 提交于 2020-01-10 04:24:05
问题 string url = re["response"][0]["url"].ToString(); MediaElement mm = new MediaElement(); mm.Source = new Uri(url,UriKind.RelativeOrAbsolute); mm.AutoPlay = true; mm.Volume = 0.7; mm.Play(); But no changes, the adudio not starts.How I can resolve this? 回答1: You need to add your MediaElement to your VisualTree before playing it, since you're creating it in the codebehind. For example, assuming you have LayoutRoot and that your url is correct, this should work. string url = re["response"][0]["url

Node.js / Gulp - Looping Through Gulp Tasks

我是研究僧i 提交于 2020-01-09 11:58:26
问题 I'd like to loop through an object and pass an array of file paths to gulp.src on each iteration and then do some processing on those files. The code below is for illustration purposes and won't actually work since the return statement kills the loop on the first pass. gulp.task('js', function(){ for (var key in buildConfig.bundle) { return gulp.src(bundleConfig.bundle[key].scripts) .pipe(concat(key + '.js')); // DO STUFF } }); That's the basic idea. Any ideas on how to do this? 回答1: I was

Multiple file in one Stream, custom stream

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-09 10:59:35
问题 According to the answer here I want to write multiple files stream to one stream as following: 4 byte reserved for length number of each stream each stream content write after it's length number(after 4 byte) at the end stream will be something like this Stream = File1 len + File1 stream content + File2 len + File2 stream content + .... Example code: result = new ExportResult_C() { PackedStudy = packed.ToArray() , Stream = new MemoryStream() }; string[] zipFiles = Directory.GetFiles(zipRoot);

Efficient way to search a stream for a string

旧城冷巷雨未停 提交于 2020-01-09 08:37:14
问题 Let's suppose that have a stream of text (or Reader in Java) that I'd like to check for a particular string. The stream of text might be very large so as soon as the search string is found I'd like to return true and also try to avoid storing the entire input in memory. Naively, I might try to do something like this (in Java): public boolean streamContainsString(Reader reader, String searchString) throws IOException { char[] buffer = new char[1024]; int numCharsRead; while((numCharsRead =

Efficient way to search a stream for a string

為{幸葍}努か 提交于 2020-01-09 08:36:52
问题 Let's suppose that have a stream of text (or Reader in Java) that I'd like to check for a particular string. The stream of text might be very large so as soon as the search string is found I'd like to return true and also try to avoid storing the entire input in memory. Naively, I might try to do something like this (in Java): public boolean streamContainsString(Reader reader, String searchString) throws IOException { char[] buffer = new char[1024]; int numCharsRead; while((numCharsRead =

OutOfMemoryException when send big file 500MB using FileStream ASPNET

只愿长相守 提交于 2020-01-09 03:19:49
问题 I'm using Filestream for read big file (> 500 MB) and I get the OutOfMemoryException. I use Asp.net , .net 3.5, win2003, iis 6.0 I want this in my app: Read DATA from Oracle Uncompress file using FileStream and BZip2 Read file uncompressed and send it to asp.net page for download. When I read file from disk, Fails !!! and get OutOfMemory... . My Code is: using (var fs3 = new FileStream(filePath2, FileMode.Open, FileAccess.Read)) { byte[] b2 = ReadFully(fs3, 1024); } // http://www.yoda

Deserialize json array stream one item at a time

房东的猫 提交于 2020-01-08 12:29:31
问题 I serialize an array of large objects to a json http response stream. Now I want to deserialize these objects from the stream one at a time. Are there any c# libraries that will let me do this? I've looked at json.net but it seems I'd have to deserialize the complete array of objects at once. [{large json object},{large json object}.....] Clarification: I want to read one json object from the stream at a time and deserialize it. 回答1: In order to read the JSON incrementally, you'll need to use

Deserialize json array stream one item at a time

我们两清 提交于 2020-01-08 12:28:01
问题 I serialize an array of large objects to a json http response stream. Now I want to deserialize these objects from the stream one at a time. Are there any c# libraries that will let me do this? I've looked at json.net but it seems I'd have to deserialize the complete array of objects at once. [{large json object},{large json object}.....] Clarification: I want to read one json object from the stream at a time and deserialize it. 回答1: In order to read the JSON incrementally, you'll need to use

Deserialize json array stream one item at a time

谁说胖子不能爱 提交于 2020-01-08 12:27:53
问题 I serialize an array of large objects to a json http response stream. Now I want to deserialize these objects from the stream one at a time. Are there any c# libraries that will let me do this? I've looked at json.net but it seems I'd have to deserialize the complete array of objects at once. [{large json object},{large json object}.....] Clarification: I want to read one json object from the stream at a time and deserialize it. 回答1: In order to read the JSON incrementally, you'll need to use