Issue Sorry if the problem is so basic, I’m a bit used to python not VB.net I’m trying to read text file data (numbers) and store it in array/list # Sample of text 1.30e+03,1.30e+03,1.30e+03 5.4600e+02,2.7700e+02,2.8000e+02 # PS: I can control
Continue readingTag: stream
[SOLVED] Java 8 – Stream API – groupingby not working
Issue I want to use the Stream API to group a list of persons by name and city. I have following code (in Java 8): class Person { private String name; private String gender; private String city; Person(String name, String
Continue reading[SOLVED] Filter Java stream if specific object is a null
Issue I have the object FastFood. In ArrayList there are 10 hotdogs. public class FastFood { ArrayList<Hotdog> hotdogs; boolean isTasty; } public class Hotdog { String name; Ingredients ingredients; } For 9 hotdogs all data is filled. For 1 hotdog,
Continue reading[SOLVED] find Duplicate Element from a List of Integer without using Stream's distinct method
Issue Recently this question is asked in Interview : How to find the Duplicate Elements from a List of Integer without using java Stream’s distinct method ? This should be done by Java’s Stream API but should not use distinct()
Continue reading[SOLVED] Process huge GEOJson file with jq
Issue Given a GEOJson file as follows:- { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "FEATCODE": 15014 }, "geometry": { "type": "Polygon", "coordinates": [ ….. I want to end up with the following:- { "type": "FeatureCollection", "features": [
Continue reading[SOLVED] Extract top-level key and contents from large JSON using stream
Issue One procedure in a system is to ‘extract’ one key and its (object) value to a dedicated file to subsequently process it in some way in a (irrelevant) script. A representative subset of the original JSON file looks like:
Continue reading[SOLVED] Read a large zipped text file line by line in python
Issue I am trying to use zipfile module to read a file in an archive. the uncompressed file is ~3GB and the compressed file is 200MB. I don’t want them in memory as I process the compressed file line by
Continue reading[SOLVED] How to take unknown number of string from file in C?
Issue I have a struct storing persons’ names, surnames and salaries, but the number of their names is random. For example: list.txt John Smith Green 1000 //He has two names Jennifer Wilson 2000 //She has one name Steve Adams 1500
Continue reading[SOLVED] NodeJS Stream Pipeline – The "val" argument must be an instance of Readable, Iterable, or AsyncIterable. Received an instance of WriteStream
Issue File: index3.js #!/usr/bin/env node ‘use strict’; import { pipeline } from ‘stream/promises’ import { realpathSync, createReadStream, createWriteStream } from ‘fs’; import { pathToFileURL } from ‘url’; async function doStuff() { return new Promise((resolve, reject) => { let readStream =
Continue reading[SOLVED] node.js: send the output of stdout as response
Issue const express = require(‘express’); const { stdout } = require(‘process’); const router = express.Router(); router.get(‘/’, (req, resp) => { var exec = require(‘child_process’).exec; exec( ‘npx hardhat run scripts/deploy-contract.mjs –network PolygonMumbai’, function (error, stdout, stderr) { console.log(‘stdout: ‘ + stdout);
Continue reading