Questions tagged [stream]

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.

Filter by
Sorted by
Tagged with
2
votes
1answer
50 views

C++ simple type serialization for streaming primitive- / pod types over a web socket (e.g. asio)

I am experimenting with asio web sockets and tried to write a simple serializer / deserializer. I am also thinking about an approach on how to serialize some type information alongside the actual data....
0
votes
3answers
95 views

Luhn algorithm using Stream API

Example ...
3
votes
2answers
116 views

Streaming substrings of a string

Given a (long) string src, generate substrings (up to) len characters long on demand by iterating over ...
3
votes
0answers
69 views

How can I filter and sort LinkedList faster and more effective?I have list of orders that should be processed

I have method that fetches all orders from Database and filtering, sorting that data(I know better to do It by specific query to Database but I dont know how). I have Order entity that has following <...
3
votes
1answer
159 views

Conditional Output Streaming in C++

I stumbled into an idea for creating a simple class that would entirely avoid streaming of any data unless some condition is met. The idea here is that a ...
1
vote
2answers
168 views

How to append values into existed Vec with iterator

I have a Vec with value default [0], and then I want to append into the vec with an iterator which is read from stdin, now my code is not performant since I use an insert to shift all the values ...
2
votes
0answers
90 views

Reading stdout and stderr of a sub process using Win32, Overlapped I/O

I'm writing C++ Windows code that will start a process, then read its stdout and stderr, separately, into buffers. If I try to just read the streams one at a time it may hang if the child process is ...
2
votes
0answers
114 views

Read compressed XML file inside ZIP and parse data as fast as possible

I am trying to read and parse an XML file inside of a ZIP archive as fast as possible. The XML file is roughly 85GB in size, so I know for a fact that I/O also plays a role here, as I need to ...
1
vote
1answer
77 views

A Paragraph Merger with Removing Overlapped Duplicated Lines in C#

I am trying to make a paragraph merger that takes multiple paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy. Each input paragraph is with the ...
1
vote
1answer
101 views

A Tiny Text File Read/Write class Implementation in C#

I am trying to implement a tiny text file read / write class FileIO in order to make the operations of reading / writing pure text files easily. The usage is like: <...
6
votes
3answers
297 views

Beginner C fgetline() implementation

I am doing C coding practice by reinventing a getline function that works with any streams. Any comments on the overall code quality, including correctness, style ...
5
votes
1answer
42 views

Filter out comments in Delphi source code

Today I am working on refactoring and documenting some ancient Delphi code. In that language, which is derived from Pascal, there are three forms of comments: ...
1
vote
0answers
393 views

NodeJS stream.Readable implementation to combine PCM audio streams

Edit: This has a bug that I didn't discover initially. I've opened an issue in the nodejs/help github. I'm not sure what that means for this post. I am creating a discord music playing bot using ...
3
votes
2answers
314 views

Multiple filters and maps java stream

I need to find the odd occurring numbers as a list. For example the below list should give 1 and 2 as output. Is there a way that I can do it in a better way? ...
1
vote
1answer
32 views

Concise and exception-prone method for running method on component

I have a list of Components. When an actor is connected, I want to run onActorConnected on each component. However, if a ...
2
votes
0answers
172 views

Javascript / Go plug-and-play server-side WebRTC support for webcam streaming

I normally program in a linux vm and decided to do some machine learning with my webcam when I realized the vm didn't have access to my camera hardware. That kicked-off a mini project to create a plug-...
3
votes
3answers
269 views

Produce the sum of all white space separated integers in a given file

How's my code? Works perfectly for what I'm trying to do :) ...
3
votes
1answer
211 views

LZW Compression Library

I wrote a library that implements LZW compression and decompression. A goal of this project was to help me acquaint myself with modern C++ development practices (I primarily come from a Java ...
3
votes
2answers
347 views

Set default value for remaining size of list by use of Java 8 and Stream

I have written a method which will return the size 16 List every time. If the input List has size less than 16, the remaining list object will be filled with default values.  Is there any way to ...
8
votes
1answer
455 views

Reading one source Stream by multiple consumers asynchronously

The problem was using single Stream from the HTTP response in multiple consumers simultaneously. For example: while data is loading, I want write it to the some ...
2
votes
1answer
652 views

Deserialise Json and Read Stream twice in C#

So this is a modern implementation of a HTTP client, trying to find a way to optimise/simplify this. Specifically the DeserializeAsync method with the GetStream and the compiler statement for if/debug ...
5
votes
2answers
149 views

Sorting squares of an integer array

I had this question in an interview recently. Given a sorted array of integers, return a list of those integers squared, with the squares sorted. So given an array of these numbers: ...
4
votes
3answers
664 views

Min heap without recursion

The code reads in integer array from user input and builds a minimum heap via an iterative scheme. Are there any edge cases in which this approach would fail? For the following test case/command ...
3
votes
1answer
65 views

Finding out the indices of common elements in two array lists having duplicate elements

I have two lists which are also having some duplicate elements , i am converting this list to map as key value pair with element index as the value for the key - element List 1 : [1, 2, 3, 4, 5, 6, ...
2
votes
1answer
58 views

Reading bytes between two quotes from a stream and decoding it to its appropriate character set [closed]

This is a component for a lexer which operates on a byte input stream that handles reading and decoding the contents of a string contained within double-quotes. The validity of the encoding is handled ...
5
votes
2answers
76 views

Concisely, robustly, temporarily stashing c++ iostream formats

I got tired of the boilerplate and tedium restoring formatting context, so I made an RAII stasher that relies on the destroy-at-end-of-full-statement temporary semantics. With C++17 I can get it down ...
2
votes
1answer
66 views

Chunking strings to binary block-based output

This is a follow up to Chunking strings to binary output I found the reviews quite helpful in pinpointing what to fix with my code. Here's the result of that update. The format of the output is the ...
6
votes
1answer
95 views

Custom manipulator for changing at what characters a std::istream split words

Introduction By default, input streams (e.g., std::cin or a std::istringstream) split words at space when using the ...
5
votes
2answers
125 views

Chunking strings to binary output

A follow-up to this question is Chunking strings to binary block-based output I have code which takes a text file as input and creates a special binary output form of the input. Specifically, the ...
3
votes
0answers
253 views

PPE object detection with tensorflow and opencv with rtsp streams

I am working on an object detection API implemented in Tensorflow 1.14 and OpenCV 4.1, where my task is to recognize personal protection equipment (PPE) worn by workers at various construction site ...
2
votes
4answers
84 views

User Specified Array Read and Modify

How may this code be improved upon, the user inputs array of specified length and replaces each element that is smaller than the mean of the first and last element with the mean. Is there a better ...
0
votes
1answer
127 views

Compare two map objects and show relative information Java 8

I have 2 maps. First map consists of order in which a specific set of services is executed. Second map contains execution time each service took. I need to display this information. Following is my ...
7
votes
2answers
73 views

Skip input to next line, for reading serialized objects

I was de-serializing objects that had an extra newline that needed to be removed before getting the next object. ...
4
votes
2answers
78 views

Filtering product ids

As regarding the following question I have completed the code as below. But I am curious about other effective solutions. I am also curious about if there is any solution that could be applicable by ...
0
votes
2answers
107 views

Refactor method to Java 8

I have a method that iterate a list of maps if a certain element is found then set value of certain variables and break the loop. I'm trying to revamp this into Java 8. And further if it can be ...
2
votes
1answer
643 views

Get word frequency of a txt file and save it to linked list

I'm a novice in C++. I want to do three things: Get the number of lines in the file Get the number of total words in the file Get each frequency of each "unique ...
6
votes
4answers
1k views

Make my XML Parser in Java using WoodStox run faster and use less memory, or just generally better

I have an XML Parser in Java using WoodStox that I wrote. This parser is going to be parsing through extremely large files, could be 5+GB. The goal of the parser is to convert a nest XML file into a ...
1
vote
0answers
574 views

HTTP Client - Best practices

I've made a HTTP client and would like some tips to improve my code, it's supposed to be built for xamarin forms but should work with any implementation. My goal of this project was to learn more ...
1
vote
1answer
168 views
1
vote
1answer
57 views

Image type convertion

So I have a piece a code that, altough it does what is expected, it doesn't seam very performant to me. I just wanted to know if there's a better way to do this or if my code is alright as it is. The ...
2
votes
1answer
47 views

Building a Map of Set using Java Streams

I wrote a collector that would take a stream of Map.Entry<Integer, MyObject> which I want to make into ...
2
votes
0answers
72 views

Stream Exercise: average delta of the yearly average temperature per country

a Temperature calss is given (not allowed to modify it): ...
-1
votes
1answer
54 views

Functional filter unique elements in sequence is not as good as imperative [closed]

Can you please help me fulfill the following? Requirements: Create an iterable with unique elements. Their order should be preserved: a | b | a | c → a | b | c ...
2
votes
1answer
124 views

Converting HashMap data to a Response object

I have a HashMap and I want to convert data in it to a Response object. Is it possible to achieve this code that parses the string in a better and optimized and cleaner way, maybe by using streams? <...
2
votes
1answer
71 views

Converts data in a HashMap to a custom object

I have a HashMap and I want to convert data in it to a Response object, but I do not find it clean and optimized. Is there a ...
6
votes
1answer
107 views

Design a native video buffer in C++ to be shown on android application and shared with other modules in native space and Java

I'm working on a design for a video buffer in C++ that will be used by many consumers both in the native library space(C++) as well as Java side using JNI. My Idea is the following: Have a buffer ...
5
votes
3answers
362 views

Proper way to find newest file in a directory

I wanted to ask if this is a better way to find a latest file in given directory. This is my current approach: ...
4
votes
1answer
321 views

Monitoring Traces for Satisfaction of Temporal Logic Properties

I am trying to implement a monitor for a certain temporal logic. What this means is the following: There is some external source, from which a trace of items are coming. An item looks like a ...
2
votes
0answers
515 views

Seekable HTTP response stream wrapper

I created this wrapper to use together with HttpClient streams and ZipArchive. ZipArchive ...
2
votes
1answer
1k views

OpenFile function in C++

I am in the process of learning basic C++ and one of the practice questions I came across was to write a function to open a file in C++. I did understand how to use the streams but I think I went ...

1
2 3 4 5 6