Questions tagged [collect]

Use this tag for questions related to the act of gathering/collecting/grouping data/results from several nodes/places/computers to one (or main) resource(s).

Use this tag for questions related to the act of gathering/collecting/grouping data/results from several nodes/places/computers to one (or main) resource(s).

For example, in Distributed Computing, the slaves would do their local computation and eventually, one would like the master to collect the (local) results.

354 questions
0
votes
1 answer

Expand along a specific symbol in sympy

When I do symbolic integration using Sympy, I would like to expand an expression along a specific symbol so that later I can collect and integrate w.r.t. that symbol. Is there a way to do such "expand" without altering the forms of other…
sunheng
  • 43
  • 4
0
votes
2 answers

Implementing collect for list in F#

I am new to programming in functional languages. I am attempting to implement the F# collect for list. let rec collect func list = match list with | [] -> [] | hd::tl -> let tlResult = collect func tl func…
Lawliet N
  • 5
  • 2
0
votes
1 answer

How to convert lines in xml by xsl?

I want to change this code Token wst b_3 c_5
Levvy
  • 1,100
  • 1
  • 10
  • 21
0
votes
2 answers

Checking for nil value inside collect function

I have an array of hashes as per below. Say my array is @fruits_list: [ {:key_1=>15, :key_2=>"Apple"}, {:key_1=>16, :key_2 =>"Orange"}, {:key_1=>17, :key_2 =>" "} ] I want to join the values in the hash using a '|'; but my final…
tech_human
  • 6,592
  • 16
  • 65
  • 107
0
votes
1 answer

Array operation using map or collect in Ruby

I have an array @a = [[9, 15], [], []] I need to make it [9,15] using map method. How it is possible? I have tried the below statement, @a.map{|array| array.collect{|element| element} if array.any?}.compact But giving [[9,15]] as output. Can anyone…
Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85
0
votes
3 answers

How to map a Ruby hash?

Is there a better way to map a Ruby hash? I want to iterate over each pair and collect the values. Perhaps using tap? hash = { a:1, b:2 } output = hash.to_a.map do |one_pair| k = one_pair.first v = one_pair.last "#{ k }=#{ v*2 }" end >> [ …
B Seven
  • 44,484
  • 66
  • 240
  • 385
0
votes
1 answer

collect possible to def queues = [] as String[]?

I have a question why using collect to a string array is not working. This is working ok String[][] serversAndQueues = [["server1","queue"],["server1","queue1"],["server2","queue2"]] serversAndQueues.groupBy { it[ 0 ] }.each { server, value -> …
user955732
  • 1,330
  • 3
  • 21
  • 48
0
votes
2 answers

Collect closure in groovy

I am new to functional programming paradigm and hoping to learn the concepts using groovy. I have a json text containing a list of several person objects like the following: { "persons":[ { "id":1234, "lastname":"Smith", …
Lee
  • 301
  • 2
  • 3
  • 10
0
votes
1 answer

how to use bulk collect in db2 cursor

Here is my procedure, I don't know how to use bulk collecton in cursor, that we can batch process the cursor data. Please help me, thanks! CREATE PROCEDURE PROC_AUTOACTIVE BEGIN ATOMIC DECLARE v_sql VARCHAR(800); DECLARE v_customer_id…
albert
  • 27
  • 7
0
votes
0 answers

JPA native query: How to collect inner fields as list

I have 2 entities: Request and Invoice. (One to many) How can I get result object: public class TestRequest { private Long idRequest; private List idInvoices; } Follow code: Query query = entityManager.createNativeQuery("Select…
0
votes
1 answer

Ghostscript merge print jobs

Dear Ghostscript Gurus. I have installed and tuned system printer to print to PDF by Gs (gswin32c.exe). The arguments of printer's port are: gswin32c.exe @"pdfwrite.txt" -sOutputFile="c:\PathToPDFFiles\%b.pdf" -c .setpdfwrite -f - And its all…
Voot
  • 1
0
votes
1 answer

rails an array of many link_to links in a sentence

The problem is, some Organization(s) don't have addresses and it breaks the page (Couldn't find OrganizationUrl with id=1826_). \ I'd like to somehow use the link if the address is present, and if not just show the name. Any…
jahrichie
  • 1,215
  • 3
  • 17
  • 26
0
votes
1 answer

How should I proceed after running the collect command?

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production. I have a table in the below format. Number User Value ------------------- 1 A 25 1 B 28 2 C 30 2 D 35 This is what I…
Rafey
  • 5
  • 2
0
votes
1 answer

Collect small JS from webpage to one big JS

This is sample JavaScript code: /* Email me Animation */ $(function() { var offset = $("#sidebar").offset(); var topPadding = 0; $(window).scroll(function() { if ($(window).scrollTop() >…
Denis S
  • 43
  • 5
0
votes
1 answer

Puppet reduce function syntax error

I'm trying to run this Puppet code, as described in Puppet documentation: # test.pp $a = [1, 2, 3] $b = $a.collect |$x| { $x + 1 } alert $b But it gives me syntax error: $ puppet parser validate --debug test.pp Error: Could not parse for…
vvolodko
  • 103
  • 1
  • 4