Questions tagged [nested]

This tag relates to any of various nested entities or operations in programming.

This tag relates to any of various nested entities in programming, including but not limited to:

  • Nested data structures
  • Nested queries
  • Nested calls to a procedure, subroutine, method or operation

For example, nesting queries in SQL means to create a subquery. Its result is used in the query itself and provides a query order and subsets.


Related tags :

16389 questions
54
votes
2 answers

CASE statement in SQLite query

Why this query doesn't work? :( I tried to replace nested IF statement "...SET lkey = IF(lkey >= 11, lkey - 5, IF(lkey > 5, lkey + 2,lkey))" UPDATE pages SET lkey = CASE lkey WHEN lkey >= 11 THEN lkey - 5 ELSE CASE lkey WHEN lkey…
VeroLom
  • 3,856
  • 9
  • 34
  • 48
54
votes
4 answers

What's the purpose of the JUnit 5 @Nested annotation

In JUnit 5, there is a new annotation: @Nested. I understand how the annotation works, I understand why we use nested classes, I just don't understand why we need to have nested test classes.
sab
  • 4,352
  • 7
  • 36
  • 60
52
votes
8 answers

Creating a nested dictionary from a flattened dictionary

I have a flattened dictionary which I want to make into a nested one, of the form flat = {'X_a_one': 10, 'X_a_two': 20, 'X_b_one': 10, 'X_b_two': 20, 'Y_a_one': 10, 'Y_a_two': 20, 'Y_b_one': 10, …
ThomasNicholas
  • 1,273
  • 11
  • 21
51
votes
9 answers

Find key/value pairs deep inside a hash containing an arbitrary number of nested hashes and arrays

A web service is returning a hash that contains an unknown number of nested hashes, some of which contain an array, which in turn contains an unknown number of nested hashes. Some of the keys are not unique -- i.e. are present in more than one of…
steven_noble
  • 4,133
  • 10
  • 44
  • 77
51
votes
6 answers

Updating nested arrays in mongodb

I have a document in mongodb with 2 level deep nested array of objects that I need to update, something like this: { id: 1, items: [ { id: 2, blocks: [ { id: 3 …
src091
  • 2,807
  • 7
  • 44
  • 74
51
votes
9 answers

Sails.js populate nested associations

I've got myself a question regarding associations in Sails.js version 0.10-rc5. I've been building an app in which multiple models are associated to one another, and I've arrived at a point where I need to get to nest associations somehow. There's…
Lars Dol
  • 765
  • 1
  • 6
  • 14
51
votes
1 answer

MySQL Nested Select Query?

Ok, so I have the following query: SELECT MIN(`date`), `player_name` FROM `player_playtime` GROUP BY `player_name` I then need to use this result inside the following query: SELECT DATE(`date`) , COUNT(DISTINCT `player_name`) FROM …
user2284433
50
votes
2 answers

How to use in JSF page? Single form? Multiple forms? Nested forms?

I am using the Facelet Templating Technology to layout my page in a JSF 2 app that I am working on. In my header.xhtml, primefaces requires that menubar be enclosed in h:form. Menu Items…
Mark Estrada
  • 9,013
  • 37
  • 119
  • 186
49
votes
8 answers

Function with varying number of For Loops (python)

My problem is difficult to explain. I want to create a function that contains nested for loops, the amount of which is proportional to an argument passed to the function. Here's a hypothetical example: Function(2) ...would involve... for x in range…
Anti Earth
  • 4,671
  • 13
  • 52
  • 83
49
votes
13 answers

Pros and cons of using nested C++ classes and enumerations?

What are the pros and cons of using nested public C++ classes and enumerations? For example, suppose you have a class called printer, and this class also stores information on output trays, you could have: class printer { public: std::string…
Rob
  • 76,700
  • 56
  • 158
  • 197
48
votes
2 answers

Nested Json to pandas DataFrame with specific format

I need to format the contents of a Json file in a certain format in a pandas DataFrame so that I can run pandassql to transform the data and run it through a scoring model. file = C:\scoring_model\json.js (contents of 'file' are…
figgy
  • 595
  • 2
  • 5
  • 11
47
votes
11 answers

How to access deeply nested dictionaries in Swift

I have a pretty complex data structure in my app, which I need to manipulate. I am trying to keep track of how many types of bugs a player has in thier garden. There are ten types of bugs, each with ten patterns, each pattern having ten colors. So…
zeeple
  • 5,509
  • 12
  • 43
  • 71
46
votes
12 answers

Creating nested dataclass objects in Python

I have a dataclass object that has nested dataclass objects in it. However, when I create the main object, the nested objects turn into a dictionary: @dataclass class One: f_one: int f_two: str @dataclass class Two: f_three: str …
mohi666
  • 6,842
  • 9
  • 45
  • 51
46
votes
5 answers

Finding max value in the second column of a nested list?

I have a list like this: alkaline_earth_values = [['beryllium', 4], ['magnesium', 12], ['calcium', 20], ['strontium', 38], ['barium', 56], …
davelupt
  • 1,845
  • 4
  • 21
  • 32
46
votes
1 answer

Ruby accessing outer variables in nested function

I'm sure there's a simple answer for this; I just can't seem to find it. I made a nested function in Ruby, and I was having trouble accessing variables from the outer function inside the inner function: def foo(x) def bar puts x end bar …
user102008
  • 30,736
  • 10
  • 83
  • 104