nested

Elasticsearch: querying on both nested object properties and parent properties

核能气质少年 提交于 2019-12-06 15:23:22
I have some documents which have nested objects inside nested objects : { "started_at": 1455088063966, "ended_at": 1455088131966, "tags": [{ "type": "transfer", "at": 1455088064462, "events": [{ "type": "transfer_processed", "at": 1455088131981 }] }, { "at": 1455088138232, "item": "tag", "type": "info" }] } Here, the main document has several nested objects (the tags), and for each tag there are several nested objects (the events). I would like to get all the documents where the events of type transfer_processed occured 60000 milliseconds after the tags of type transfer . For this, I would

Devise nested resource view shows no method error

点点圈 提交于 2019-12-06 15:14:14
问题 My nested resource is farm. In my routes I have: resources :users do resource :farm end devise_for :users, :path => 'accounts' So, the devise paths for sign up, etc are working and not making problems. But when I try to make a new farm, I get this error: undefined method `farm_user_path' for #<#<Class:0x463d8f8>:0x46493e8> I am accessing it via: <%= link_to "New Farm", new_user_farm_path(current_user) %> In my farm controller, I have: class FarmsController < ApplicationController # GET /farms

Tkinter Nested Frames with Grid Manager Issues

送分小仙女□ 提交于 2019-12-06 14:56:49
I am redesigning the layout for a interface using python 2.6 and the standard Tkinter included with it. Trouble is that I am noticing some strange behavior, and I am new to Tkinter so this may just be something simple I am overlooking due to inexperience. Here is some example code of how I am nesting frames inside a master frame in order to get the desired layout: import Tkinter as tk root = tk.Tk() master = tk.Frame(root) frame = tk.Frame(master).grid(sticky = tk.W) item1 = "Label One" L1 = tk.Label(frame, text = item1).grid(sticky = tk.W) b1 = tk.Button(frame, text = "Button 1").grid(sticky

AutoForm 5.0.2 nested schema inputs required on update

别等时光非礼了梦想. 提交于 2019-12-06 14:23:31
问题 I have schemas set up so that I can have an array of complex input sets. Something like: address = { street:{ type: String }, city: { type: String }, active_address: { type: Boolean, optional: true }, ... } people: { name:{ type: String }, address:{ type: [address], optional: true, defaultValue: [] } } This way adding an address is optional, but if you add an address all of the address fields are required. This worked in (I believe it was) version 4.2.2. This still works on insert type

Finding maximum of 3 numbers using nested if/else statements

谁都会走 提交于 2019-12-06 13:39:12
So I'm in college and I'm writing a program using C# which is ALMOST done except for this button. I don't want the answer because I'll never learn that way, but I'm writing a program using Heron's method where the user has to input 3 numbers to determine if these numbers can be used as sides of a triangle. The one button I am confused with is the Finding the Maximum button which wants the program to show which number entered is the highest. The professor wants this code to be written using nested if/else statements. I have searched online and the book for the course is terrible. Could someone

nested hashmaps of unknown depth java

不想你离开。 提交于 2019-12-06 13:36:47
I have a requirement in which I need to have an nested hashmap. But the depth would be decided at run time. E.g. If at runtime, user says 3, then my hashmap should be like HashMap<String, HashMAp<String, HashMap<String, String>>> if he says 4 then HashMap<String, HashMAp<String, HashMap<String, HashMap<String, String>>>> Is there any way to implement this kind of functionality? Some other API or toolkit?? Oh, this is almost certainly a very bad idea. You sound like you really want a tree or graph and don't know how to write it, so you're inventing this notation to try and make it work with

Avoid nesting from conjunction with function that returns 2 values in go?

痞子三分冷 提交于 2019-12-06 13:14:39
Here, I have a conjunction expression involving some functions that return 2 values: if _, ok := f(); ok { if _, ok := g(); !ok { if h() { if _, ok := i(); ok { doStuff() } } } } Could I somehow avoid the nesting? Instead of nesting, could I write this as an expression in one line (I can't quite break or return early in this case)? With a helper function, you can. Create a helper function which returns the second bool return value, e.g.: func check(dummy interface{}, ok bool) bool { return ok } And using it: if check(f()) && check(g()) && h() && check(i()) { doStuff() } Note that this is

Is it Possible to Nest Collections within Collections using Wpf DataGrid?

允我心安 提交于 2019-12-06 12:19:36
I want a simple sample program that nests collections within collections using Wpf DataGrid. Here's an implementation using VB.Net codebehind. Code is needed only to create test data. Class MainWindow Public Property cs As New List(Of c1) Sub New() ' This call is required by the designer. InitializeComponent() For i1 = 1 To 3 Dim c1 = New c1 cs.Add(c1) c1.c1text = i1 For i2 = 1 To 3 Dim c2 = New c2 c1.c1col.Add(c2) c2.c2text = i1 & i2 For i3 = 1 To 3 Dim c3 = New c3 c2.c2col.Add(c3) c3.c3text = i1 & i2 & i3 For i4 = 1 To 3 Dim c4 = New c4 c3.c3col.Add(c4) c4.c4text = i1 & i2 & i3 & i4 For i5 =

nested regular expressions in python

送分小仙女□ 提交于 2019-12-06 12:07:18
问题 In perl I can do this: $number = qr/ zero | one | two | three | four | five | six | seven | eight | nine /ix; $foo = qr/ quantity: \s* $number /ix; My actual regular expression is many lines and does two-digit and ordinal numbers (e.g., "twenty-two", "forty-fourth" and "twelve are all complete matches), and I use it in several places. This expression compiles fast, but it is certainly non-trivial. I prefer to compile it once and then add it to other regular expressions, as Perl allows. Is

Cython : exposing C++ classes with nested typedef (s)

荒凉一梦 提交于 2019-12-06 10:41:33
According to this question/answer in stackoverflow, it is not possible to directly rewrite C++ nested typedefs in cython. I have such a problem and I don't know which is the right/optimal way to proceed. Let me be more specific with an example. Below, you can find the content of two C++ files (one header.h and one .cpp) and of two corresponding cython files (one .pxd and one .pyx). In the C++ header file called cpp_graph.h you can see nested typedef declarations; for example, that corresponding to Graph::iterator::nn_iterator . I don't know how to expose that in the corresponding graph.pxd