Questions tagged [flatten]

Flattening refers to either reducing a multi-dimensional array to a single dimension or to reducing a class and class methods to handle based function calls.

1554 questions
0
votes
4 answers

Flatten object of objects

I tried like this and it works for an object with one property: var foo = { foo: { foo: { foo: function(){ return x }}}}; function flattenObj(obj) { var res; for (var k in obj) { res = obj[k]; while (k in res) { res = res[k]; …
lokhura
  • 15
  • 1
  • 4
0
votes
4 answers

Flattening a Set of pairs of sets to one pair of sets

I have a for-comprehension with a generator from a Set[MyType] This MyType has a lazy val variable called factsPair which returns a pair of sets: (Set[MyFact], Set[MyFact]). I wish to loop through all of them and unify the facts into one flattened…
jbx
  • 21,365
  • 18
  • 90
  • 144
0
votes
1 answer

What do we mean by flattening of WSDL file?

Flattening of web service description language file refers to which process?
user2877969
  • 149
  • 11
0
votes
1 answer

Create flat array from recursive function instead of flattening after

I have a recursive function that does a lot of functioning and some database calls and what not to create some cool stuff. I want to save the results of each call to the function into an array. So I did that, and I get a multidimensional array…
Jacob Raccuia
  • 1,666
  • 1
  • 16
  • 25
0
votes
1 answer

Flatten a PDF with PHP (PDFTK)

I am using PDFTK to flatten a PDF with PHP. Problem is that all special characters (É,è,à, etc.) disappear once flattened. Tried UTF-8, unicode chars, htmlentities, etc., it's all the same as a result. Therefore, I would like to solve PDFTK issue OR…
guylabbe.ca
  • 871
  • 2
  • 11
  • 21
0
votes
2 answers

Flatten XML with varying child node structure using PHP

I've got to parse and flatten an XML file that consists of a lot of single products. The XML is thoroughly documented and it's easy to parse the XML in PHP using SimpleXML. Please, see the code below how I'm creating an array from a single product.…
z80crew
  • 1,150
  • 1
  • 11
  • 20
0
votes
1 answer

Flatten some directories but not others automatically?

I have a directory with several thousand subdirectories inside (no subdirectories within those subdirectories however), and I need to flatten the contents of only some of the subdirectories, so basically bringing the contents of those directories to…
0
votes
2 answers

How can I flatten a resultset in SSIS?

I have a requirement to "flatten" a resultset in an SSIS package - this is, take a result set consisting of a number of rows and produce a single string with the concatenated values. The result set is returned to me via a stored procedure that for a…
Chris
  • 3,487
  • 3
  • 25
  • 37
0
votes
1 answer

Flatten XML and Access Previous Node

I'm trying to output data in the node and also the previous node. I can access the previous node when in the same but once it moves to next group I loose the previous.
Trist
  • 1,306
  • 1
  • 11
  • 17
0
votes
3 answers

Concatenation of inner lists or ints

I feel like I'm missing something obvious, but there it is... I would like to go from: lst = [[0, 1, 3, 7, 8, 11, 12], [8, 0, 1, 2, 3, 14], 2] to: output = [0, 1, 3, 7, 8, 11, 12, 8, 0, 1, 2, 3, 14, 2] I can do this with a for loop such…
blazetopher
  • 1,050
  • 9
  • 13
0
votes
2 answers

Flatten Nested Array to a certain Key

I have a data structure like this Array ( [0] => Array ( [actionResult] => Array ( [show_page] => Array ( [15] => Array …
Benjamin
  • 429
  • 4
  • 17
0
votes
1 answer

How to get the last non empty value of a hierarchy?

I've got a hierarchy with the appropriate value linked to each level, let's say : A 100 A1 NULL A2 NULL B B1 NULL B2 1000 B21 500 B22 500 B3 …
stormblow
  • 388
  • 1
  • 2
  • 12
0
votes
1 answer

Flatten a nested hash in Ruby on Rails

I have a hash in the structure below { "Result": [ { "Links": [ { "UrlTo": "http://www.example.com/", "Visited": 1365128454, "FirstSeen":…
Max Rose-Collins
  • 1,904
  • 5
  • 26
  • 45
0
votes
1 answer

Flattening a 3D array in c++ for use with MPI

Can anyone help with the general format for flattening a 3D array using MPI? I think I can get the array 1 dimensional just by using (i+xlength*j+xlength*ylength*k), but then I have trouble using equations that reference particular cells of the…
Mechy
  • 259
  • 1
  • 4
  • 14
0
votes
0 answers

Flatten multiple M-to-N in MySQL or go documental?

. . I am refactoring an old MySQL database for a project. We have a products table (some 20k rows and it will possibly grow to 40k or a little more) and different types of categorization (currently 4 kinds). For simplicity's sake I'll create an…
diego nunes
  • 2,750
  • 1
  • 14
  • 16