Most voted "stream" questions
67 questions
Sort by count of
-
21
votes1
answer3068
viewsHow Do We Really Understand Streams?
Work for a while with C# and . NET and several times I have seen the use of streams out there for reading files, writing HTML response, uploading files and etc. It turns out that I until today did…
-
18
votes1
answer6209
viewsDifferences between getClass(). getResourceAsStream() and getClass(). getClassLoader(). getResourceAsStream()
In the need to load a resource in my project I came across these two methods. From the choice between one of the two arose some doubts about which I would like to share here. What is the motivation…
-
16
votes2
answers596
viewsWhy is there such a difference in performance between stream and normal loops?
I was reading a article related to the performance of streams/loops, and was startled by the difference in performance between the use of loops for large quantities of data. I decided to perform a…
-
15
votes1
answer357
viewsHow to use Bilge and stream?
I can understand expressions lambdas perfectly in simple cases such as: () -> 42 // Não recebe nada e sempre retorna "42" x -> x*x // Recebe algo e retorna seu quadrado (x,y) -> x + y //…
-
14
votes1
answer37459
viewsWhat is the meaning of the word "Cout" in C/C++?
Well, it is very common in programming languages to have responsible keywords for printing data output. Some are classic like echo, print, printf and write, etc.. But in the C/C++ we have the cout.…
-
14
votes3
answers2118
viewsMemorystream vs Stream
What would be the main difference between the two? There are advantages to performance gain? For web use, which is the most appropriate? I’m using to "read" a array Byte[]: private void…
-
13
votes2
answers6409
viewsWhat is a stream?
In both PHP and C#, languages I’ve been using in my day to day life, I’ve come across a common term: Stream. Whenever I hear the word Stream, the first thing that comes to mind is Youtube, among…
-
9
votes2
answers710
viewsSelect "maximum" elements given a certain criterion in a "stream"
I have a collection of elements that I’m going through in a stream. Suppose it is to take the highest value element (integer) given a classification (string). This class is enough to exemplify my…
-
7
votes1
answer2555
viewsStream() and parallelStreams()
I saw that the performance using Amble and streams is much better than using repeat loops, so I try to use as much as possible. My question is when should I wear Streams or Parallelstreams? How does…
-
7
votes1
answer586
viewsDo Java 8 streams and streams bring more benefits than concision?
The only benefits I understand in Amble and streams Java 8 is code saving and, as the case may be, better expressing the author’s intention. That’s all? Is there any example of code that uses one of…
java lambda-expressions java-8 functional-programming streamasked 7 years, 4 months ago Piovezan 15,850 -
7
votes2
answers972
viewsHow to use Stream.reduce() appropriately
My problem: I have an Arraylist of the type of Routes (first value is the name of the city, second value is the destination city and the third value at distance), I want to create a new map…
-
6
votes1
answer102
viewsHow does . pipe() work on Node.js?
I have a question about how the .pipe(). I saw videos and read the documentation, but I’m not sure how it works. From what I understand, he basically takes the information from a readableStream and…
-
5
votes1
answer114
viewsLoad XML file stream in Xrrichtext
In my application, I receive a array of bytes file XML. With it I create a stream, but when I try to load it and insert it into XRRichText, nothing happens. However, the stream on a user’s computer…
-
4
votes2
answers862
viewsReading PDF with Defaultstreamedcontent. How to close it?
I have a JSF page where I Gero a PDF and need to show it on the screen. For that, I created a <p:media> It is working, but the PDF file gets stuck (never closed) and over time it ends up…
-
4
votes1
answer686
viewsTurn Stream into PDF to send with attachment in email
I am making a page to send email, and I need to turn a specific page into pdf to be attached to the email. The page I already managed to turn into Stream, now how can I do to turn it into pdf and…
-
4
votes1
answer112
viewsHow to print a hexadecimal value in high box?
I made a program in C++ that reads a number and prints it in hexadecimal, follows the code below. #include <iostream> using namespace std; int main(void) { int n; cin>>n;…
-
4
votes2
answers387
viewsProblem with audio stream on android
My shorthand code is this: MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource("http://stm43.srvstm.com:8474/;");…
-
3
votes2
answers757
viewsCreate a Stream object from a string
I need to create an object of the type System.IO.Stream from the content of a string. This one of mine string is in an archive Resource.resx. I get her back that way: string xml =…
-
3
votes1
answer1906
views -
3
votes1
answer403
viewsHow to use Java 8 Stream in an Object[] list
Imagine the following scenario: A list of Object[]. Something like that: List<Object[]> lista = new ArrayList<>(); Object[] dados = new Object[3]; dados[0] = 1; dados[1] = 20; dados[1] =…
-
3
votes1
answer167
viewsHow they work and what the concept of streams in PHP is
I would like to know how it works and what the concept of streams is. I’ve used streams to get input, I also know there are others to control output. However, I would like to know the theory and…
-
3
votes1
answer36
viewsIf the class ofstream is to write to files, ifstream to read and fstream to both cases, why not always use fstream at once?
Even if we wanted to read, write, modify, create, delete files, or other operations, we could no longer use the class fstream? What problems could they generate if you don’t use those specific?…
-
3
votes1
answer1996
viewsAdvantages and disadvantages of using PHP Video Stream?
Researching a little about the performance of videos for stream, I found a solution that fits me well, that would use a PHP script to send the video in parts to the player, and such method would not…
-
3
votes1
answer156
viewsmap.foreach Unexpected Return value
I have the following map: private static Map<ParseCreator, Parseable> map = new HashMap<>(); I walk this map as follows: for (Map.Entry<ParseCreator, Parseable> entry :…
-
3
votes1
answer270
viewsFunction . filter() for a List<Class>
I have a class Pessoa that has the columns Integer id. String name, and String date_born. In my main Activity I am already retrieving the list of people that comes from my request made in the API…
-
3
votes2
answers515
viewsJava 8 stream - performance improvement
I am implemented a method that receives an integer value k (representing the amount of "vacancies") and two lists (p and q) of Integer and perform some operations. Using stream, check which elements…
-
2
votes2
answers3451
viewsRead a comma separated string
My reading has been established to the comma, but he’s reading the whole field to the end of the line when reading the string. The code is read correctly, but only in the code. #include…
-
2
votes3
answers4417
viewsJava 8 (Stream) - Grouped sum
Good morning. I have the following function below: private List<Object[]> calcularTotal(List<Object[]> lista, int chave, int valor){ return lista.stream() .map(l -> new Object[]…
-
2
votes1
answer977
viewsError writing file stream
The flow was not writable You receive this exception when trying to change a file that is on Resource. Follows the code: var assembly = Assembly.GetExecutingAssembly(); Stream str =…
-
2
votes2
answers804
viewsGenerate text file from a console application
I need to adapt this method of an application Windows Forms https://github.com/BoletoNet/boletonet for Console Application, that is, instead of using the object saveFileDialog.ShowDialog() I have to…
-
2
votes2
answers1284
viewsForeach with lambda which returns the sum of iterated items
I’m trying to iterate on a List calling for produtos of objects called Produto, using the forEach, to obtain the sum of the values of these products using the lambda function of the forEach. But I…
-
2
votes1
answer1008
viewsVideo stream with Nodejs and Socket.io
I need help to stream with Nodejs and Socket.io. I’m using the rtsp-ffmpeg library to stream. I was able to execute it transmitting in img format according to the specific documentation itself, but…
-
2
votes1
answer259
viewsHow to upload an image to Nodejs?
Good afternoon, I want to make a POST Request of the client in JAVASCRIPT with DATA Send (file . jpg) in date URL for the NODEJS server. [Client] - Javascript finalImg.onload = function(event){ var…
-
2
votes1
answer2891
viewsJava 8 - Browse list, change found case, if not, add
In a shopping cart app, I have inside the class CarrinhoCompras the following attribute: List<Item> itens = new ArrayList<>(); And a method to add item, which receives a product, its…
-
2
votes1
answer32
viewsWhat is the real difference between Fs.readFile() and Fs.createReadSream()?
The point is that I can use both functions to do the same thing. For example: const fs = require('fs') const path = require('path') const filePath = path.join(__dirname, '../arquivo.txt')…
-
1
votes1
answer560
viewsResponse.Write/Flush hangs after many calls
DISCLAIMER: I posted the same question in Stackoverflow in English, I will carry the valid answer from here to there or from there to here if necessary, but I know that not all users here access…
-
1
votes3
answers1404
viewsInfinite loop when typing a character
I’m doing error tests on my "Monkey Test" program and it goes into loop infinite when I type a character on the keyboard other than number. int ActionGenerator() { bool Verify; int Action; Verify =…
-
1
votes0
answers265
viewsAudio stream (Webradio)
Good afternoon. Excuse my ignorance, but how do I create a radio web (in a very rustic way, only for study purposes)? My project is the following: I have a website that plays the audio and who…
-
1
votes2
answers444
viewsStreaming data over HTTP in Javascript
There is some way to send data over Http, but instead of all the information at once, send one part at a time? For example: I make an HTTP request to GET /produtos. This will return all my products…
-
1
votes1
answer160
viewsInfinite loop with data stream in PHP
I have the following code below: <?php $Start = microtime(true); $Code = <<<'Code' <?php for($i = 0; $i < 300; $i++){ echo '.'; } Code; include 'data://text/plain,'.$Code; echo…
-
1
votes2
answers138
viewsStream Manipulation(java 8)
Good morning guys I would like to get a little doubt, I have a String Stream with many lines of a txt, I need to do a split to break the lines in the Pipes, but the return as you know is a String…
-
1
votes1
answer85
viewsSave output after applying an replace
Hello, I have the following code below, but I need to apply a replace in the output(FileOutputStream) picked up via http before saving him. public void DownloadFile(String fileURL, String fileName)…
-
1
votes1
answer531
viewsSerialize/Deserializar Datetime
I am saving in text file a serialized object that contains only fields of type Datetime, however, the date is saving in the wrong way. I will demonstrate with an example what I am doing. My…
-
1
votes0
answers33
viewsStreamwriter C#
I have the following code: using (var stream = new System.IO.StreamWriter(System.IO.File.Open("c:\\file.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite))) { infoSerializer.Serialize(stream,…
-
1
votes0
answers297
views"Invalid class Typecast" when loading stream from Sqlite (Delphi)
I’m trying to find an image I’ve already entered in my Sqlite database, however on the line ms:=query.CreateBlobStream(query.FieldByName('imagem'),TBlobStreamMode.bmRead); have error "Invalid class…
-
1
votes0
answers40
viewsIs it possible to fill a tree list in reverse using stream?
The point is this My class public class Node{ private String name; private Node parent; private List<Node> children; public Node() { } public Node(String name) { this.name = name; } public…
-
1
votes1
answer124
viewsDifference between using a Stream or Collection
I see that the use of stream Java 8 is recommended for large amount of data. If the data set is small, there is some gain from using only Collection?
-
1
votes2
answers1283
viewsJava socket issues, how to send and receive messages simultaneously between client and server?
I am working with java sockets and I was able to come across the following problem, writing the server class sent a message to the client to read, so far everything, ok!! But when I try to send a…
-
1
votes0
answers187
viewsRecording file from stream-webcam
I have a question about my stream code with getusermedia. I want to send my Node.js server a recording of my webcam. My form receives a video I can upload, but it would have a second function…
-
1
votes1
answer1216
viewsHow to read a keyboard number without using "enter" in C++
I want to create a menu in which the user chooses the option 1 to 5, I would like the user to type the number and the program to enter the option without pressing Enter. Follow an example #include…