A stream is a series of data elements (characters, bytes or complex packets) which can be accessed or made accessible in a serial fashion. Random access is not possible.
1
vote
0answers
11 views
Node.js stream of objects from MongoDB
I have a collection inside MongoDB with thousands of documents. A document should be processing depending on some logic. To make the point simple, I suppose here there is a field ...
-3
votes
0answers
24 views
Java stream: filter collection by contingently primary key of an object [on hold]
I have object Event, the field name of it considered to be unique.
I would like to return object by name.
...
3
votes
0answers
46 views
Facet for simple math expressions
I've built simple math expression facet which ignores any character except numbers and operators listed below:
plus, minus, multiply, divide, degree, left bracket, right bracket, assignment
I'm ...
4
votes
1answer
73 views
Replace EOL in stream
I need to replace the windows EOL "\r\n" with just "\n", and I want to this in the fastest way possible, as the software will have a lot of files to upload, many of them with a few thousands lines. ...
-3
votes
0answers
14 views
Why does this work on windows and break when I compile on linux? [migrated]
I'm writing a console application for managing and tracking characters, monsters, turn order and conditions applied to make my battle run faster in DnD. The following code works perfectly on windows ...
3
votes
4answers
72 views
Unit testing for concatenating two int arrays
Using Java 1.8, I created the following implementation to concat two int arrays:
...
3
votes
2answers
43 views
(Follow Up) Armstrong numbers in a given range using Java 8
Previous Question: Armstrong numbers in a given range using Java 8
Updated program for getting all Armstrong Numbers between 1 and ...
4
votes
1answer
61 views
Armstrong numbers in a given range using Java 8
Was fiddling with java-8; trying to write a program for getting all Armstrong Numbers between 1 and 10_000_000.
Following is my ...
3
votes
1answer
70 views
Packing and unpacking bits (2)
Part 1 here.
I improved my code from my previous question (linked above).
...
2
votes
1answer
45 views
Output stream-based pseudorandom number generator
I finished an output stream-based pseudorandom number generator, that works based on the current time and output data.
Here is the header's code (entrostream.hpp):
...
6
votes
2answers
119 views
Packing and unpacking bits
Part 2 here.
I wrote this class for packing data.
Would it benefit from being named BitPacker rather than BitStream (and change write/read to pack/unpack), or it works as is?
How can I improve it? ...
3
votes
2answers
40 views
Optimized Int Reader
I am new in Golang, and decided to create a function that could cater to my needs of reading an integer from stdin. I need the function to be as efficient and fast ...
4
votes
4answers
154 views
Implemenation for concurrent file access (read/write)
I am developing an application that works with files and folder on a network share (similar to the windows explorer). The application is used by multiple users and provides some commands for modifying ...
5
votes
2answers
40 views
Search files from large directory and sub-directories
Essentially I have a large directory with many sub-folders and different formats of files. It reads through XML, JAVA, .txt, etc, in search of a selected String inputted by the user. The results ...
4
votes
2answers
84 views
On-line evaluation of mean and variance in C#
In various projects, I have to evaluate the mean and/or the variance of relatively large samples.
I wrote the following, to help me evaluate these quantities with a constant footprint. Basically, it ...
1
vote
0answers
27 views
Customized streambuffer for C++ istream
Basically I implement a traditional file-descriptor-based streambuffer for istream operations. The implementation overrides the ...
3
votes
1answer
59 views
Efficient File Searching
During an interview I was asked to consider the following:
You are trying to find an instance of an error code within a number of log files within a directory. The goal is to count the number of ...
3
votes
1answer
52 views
“Multiplying” 2 lists of Strings together in Java 8
The following method is part of a class that imports zip archives, and part of that class's job is to verify that a given zip archive contains "complete filesets". A "complete fileset" is one such ...
7
votes
3answers
2k views
Printing alternating characters of a string using Java 8 streams
Given a string, S, of length N that is indexed from 0 to N−1, I want to print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line:
Hacker -> Hce akr
My code ...
3
votes
2answers
312 views
Determining the largest sum of contiguous integers in a list
I'm curious how I can improve the readability of this short program I wrote. Mainly, if and how there is a way to remove the for loops and maybe refactor the ...
5
votes
0answers
42 views
Creating an istream peeker
I want an istream that you can safely peek arbitrarily many characters from. This works as far as I can tell, but I am unsure if this is really "the right way" to ...
1
vote
2answers
55 views
Silly redis implementation
This is a silly Redis implementation that handles only three commands: INFO, ECHO, PING.
The implementation is based on streams:
...
1
vote
1answer
71 views
Copy a stream to a file using Universal .NET
I have answered to a question on Stackoverflow where Andy struggled to cancel a Stream copy to file operation using the Universal .NET Framework:
Apparently, cancelling the cts CancelOperation token ...
1
vote
2answers
435 views
Are there mistakes in reading file?
I've recently made a test. There were four tasks. One of them was to improve following code:
...
5
votes
2answers
260 views
Java 8 Stream to produce all permutations of an array using recursion
I want to write a class that returns a Stream of permutations of an int[].
...
2
votes
1answer
485 views
Printing longest sequence of zeroes
I am doing a coding exercise in codility and I came across this question:
A binary gap within a positive integer N is any maximal sequence of
consecutive zeros that is surrounded by ones at both ...
3
votes
1answer
57 views
Delayed output stream “manipulator”
I was just playing around with some code and had the idea about writing some kind of ostream manipulator to delay the output of characters in a typewriter like ...
3
votes
2answers
335 views
C getline() implementation
I'm practicing my C coding and I wanted to implement my own version of the getline function in C for learning purposes. I'd like a review on coding style, ...
5
votes
2answers
77 views
Reading input from stdin
I read user input from stdin in plain C.
The problem is that I want a sane implementation that is robust to errors and ...
4
votes
0answers
105 views
Streaming Json Serialization Using C++
I've written a C++ library for serializing objects to a stream as Json with the following goals in mind:
Minimal run-time overhead (write the contents of an existing object/array to the stream ...
4
votes
2answers
109 views
Closing InputStream of a running process
Let's say you want to extract the output of a console application till you've found a certain keyword. If you have found the keyword the started console process still should be running, however the ...
2
votes
2answers
107 views
Xml messages processing networkstream [closed]
I'm currently processing xml messages with C#. It is working But I'm not confident that my code is fast enough. There are 3 possible messages I can receive. When I receive one the message an event is ...
1
vote
1answer
223 views
ISO8583 encoding data fields
I just want to confirm that my ISO8583 format is correct.
Example:
For the data field 35, the length of the data is 36, so I put 36 before the 4842. Then all the data is inserted in a string (...
4
votes
1answer
86 views
Clojure word count
I'm fairly new to Clojure and looking to improve my use of the proper idioms, and make my code more readable. Here's the problem:
Read from standard input and produce the count of each word to ...
5
votes
2answers
506 views
Counting words from standard input in Swift
I know Swift isn't exactly meant to be used to write your classic stdin to stdout scripts, and that Python, Ruby, Perl, bash, awk, and friends are much better in this area, but I'd still like to see ...
2
votes
1answer
175 views
Prepend data to stream in C#
I'm working on an XNA project that loads several resources that are packed into a single file. XNA can take a WAV file stream and turn that into a SoundEffect (seen below in "case ".wav"").
Since ...
6
votes
1answer
449 views
C++ console program
I have been learning C++ programming. What you see here is all that I know how to do at this point. I look forward to learning more and I know there are better ways to accomplish a task such as ...
4
votes
1answer
68 views
OutputStream class for use with subprocess.Popen
I've recently been writing an application which does a lot of work with the output of commands. To call the commands I've been using the subprocess module, and originally, was using ...
3
votes
2answers
87 views
ConsumingRouter to consume based on condition
Started as to make a stream splitter to split stream based on condition, but finally found that I did ConsumingRouter, to consume based on condition and while have to provide consumers before using ...
6
votes
1answer
332 views
Java InfiniteStream with Queue
I did InfiniteStream by implementing Stream and Consumer. You can initiate the stream then ...
6
votes
3answers
95 views
begin and end overloads for istream_iterator
I wrote this pretty straight forward begin and end overloads for istream_iterator.
Is this standards compliant? Any problems with usage?
...
8
votes
1answer
86 views
Stream manipulating indenter
I've always wanted to be able to steer stream indentation, so that I could write code like this:
...
12
votes
1answer
200 views
Mandelbrot Streams
A recent Mandelbrot question (Hi @EBrown) in C# inspired me to build my own using the Java 8 parallel streams to implement the parallelism that's useful for computing each pixel value.
The intention ...
6
votes
1answer
147 views
Reading bits from a stream from least to most significant
For a recent project I was in need of excessive bit manipulation. Specifically, I had to write to or read from a variable number of bits up from the least significant bit towards the most significant ...
5
votes
3answers
430 views
Duplicate words in a text
Here is a simplified implementation to obtain the duplicate words in a text using lambda expressions.
...
4
votes
1answer
174 views
White box input stream for creating test scenarios
I need to test a specialized input stream class that takes input from a TCP/IP network connection. I particularly need to ensure that the blocking and availability behavior is correct.
To help me ...
4
votes
1answer
111 views
Passing variable pointer as string to another function
With Delphi 7 I need to create a TStream variable and use/free it in another part of the code. Unfortunately it cannot be passed as "normal" parameter.
I created a ...
7
votes
0answers
118 views
Processing files with streams
I'm using io.js. I have to read some files as a stream, process them with the same function, and join them back into a stream. I decided to create my own solution with ...
0
votes
0answers
195 views
Custom capacity aware stream grouping
This is the code to make a capacity aware stream grouping for Storm topologies. Please review this.
The summary method has to be called every ten minutes once.
Future task - This method and fields ...
5
votes
1answer
285 views
A Stream wrapper that executes all writes asynchronously
I wanted to make a Stream that can wrap another stream and buffer all writes, to increase performance; comparable to the ...