FAQ Database Discussion Community


Create a Nested Loop on Java [closed]

java,loops,nested
I'm a newbie on Java Programming and self studying at home. I got this problem on a book and cant figure it out: Write a java program that would display the following using nested loops: 6 12 13 19 20 21 I can create the same pattern using the following...

update nestet set tree with php and nestable.js jquery plugin

php,jquery,nested,codeigniter-2
EDIT: After great answer the @vadim-ashikhman. The end of the question. Good Afternoon, First of all I want to say that I've been looking everywhere and have not found any response that is equal to is. Resources I'm using: PHP Framework Codeigniter Nested set Library : https://github.com/olimortimer/ci-nested-sets/ Jquery library:...

How to store multiple entries for each student using dictionaries

python,dictionary,nested,hierarchical-data
Here is the problem statement: There is a record of 'n' students, each record having name of student, percent marks obtained in Maths, Physics and Chemistry. The user enters an integer 'n' followed by names and marks for the 'n' students. I am required to save the record in a...

Serialise nested list or alternatives

c#,list,serialization,nested
I am trying to store a collection of lists (each containing over 20.000 int's) and was hoping to use a nested lest for this since each day a new list will be added. Eventually I need to access the data in the following way: "Take the first value of each...

ReactJs: transitions in nested elements

animation,nested,reactjs,transitions
I am new in ReactJs, developed multi nested folders browsing - what I mean is here - https://jsfiddle.net/69z2wepo/7804/ . var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; var List = React.createClass({ getInitialState: function() { return {data:this.props.data}; }, onClickHandler: function (nodeName, i, e) { e.stopPropagation(); var newState = this.state.data[nodeName][i].isExpanded?false:true; this.state.data[nodeName][i].isExpanded = newState; this.setState(this.state); }, render:...

Can't access strong Params through another Model. Rails 4

ruby-on-rails,ruby,ruby-on-rails-4,nested,associations
For some reason I can't access param from another model. I use in my code has_many :through association. I use rails 4.2. Here is my code: /models/company.rb class Company < ActiveRecord::Base has_many :bonds has_many :users, :through => :bonds end /models/user.rb class User < ActiveRecord::Base has_many :bonds has_many :companies, :through =>...

How can I use python to display nested lists in separate lines in kv label?

python,list,nested,label,kivy
I have a list of lists, where there are 3 items per inner list (as in the example below). data = [ ["abe","abo","aba"], ["ade","acd","acr"], ["adr","adw","adz"], ["akw","aky","akz"], ["bad","bbf","btr"], ["bst","bsv","bus"] ] In the kv file, I have set a Label (inside a ScrollView) to display information from the list when the user...

Why does my nested for-if loops load much slonger when I dont nest this? And can I possibly fix this?

c#,excel,if-statement,for-loop,nested
Sorry if the question if a bit vague, but the code is very complicated and I hope you will have the right eye to see and understand it :) I will show 2 sort codes. The codes just read an excel sheet and depending on the text it contains, it...

Simpler alternative for accessing master object from nested listview on XAF

c#,listview,nested,viewcontroller,xaf
I want to know if there is simple and clear method other than this for accessing master object from a nested listview controller. ((PropertyCollectionSource)((ListView)View).CollectionSource).MasterObject Do I have to write this in everywhere where i need to access master object? I think this is not an elegant way and looks so...

T-SQL alternatives to nested CASE for better performance?

sql-server,tsql,nested,case,sql-tuning
I have a T-SQL query that is performing very poorly to the point that it times out. The culprits are these two nested CASE statements with embedded queries: SELECT CASE WHEN b.month_type = (CASE WHEN dbo.CURRENT_BUSINESSDAY(GETDATE()) >= 8 THEN 'Current Month BD2' ELSE (CASE WHEN dbo.CURRENT_BUSINESSDAY(GETDATE()) < 8 AND (SELECT...

UI-Router $stateParams With Master Detail Pattern

javascript,angularjs,nested,angular-ui-router,state
I need a Master Detais pattern for my web site. In index lots of thumbnails and every thumbnail link to their detailed page. I make a progress but does not get to work. Its load thumbnails on index oage but when I click to thumbnails its load blank page. Index:...

Why can't i use struct nested in a struct as a type to declare variable in a class template? [duplicate]

c++,class,templates,struct,nested
This question already has an answer here: Where and why do I have to put the “template” and “typename” keywords? 6 answers You see, i like structs, so i put some structs inside structs and try to use these nested structs in a class template to declare some variables....

Defining a “vector_cast” template function that works with a variable amount of nested vectors

c++,vector,casting,nested
I want to be able to do something like this for example. std::vector<std::vector<int>> e = {{ 1 },{ 2 }}; std::vector<std::vector<double>> q = {{1.5},{2.5}}; q = vector_cast<double>(e); But also have vector_cast be able to handle any number of nested vectors. Here is my attempt at this. The code works if...

How to make nested while loop faster in R? Converting to C++

c++,r,while-loop,nested,variable-assignment
This question seems to be answered but I didn't get quite a certain idea from the previous answers. I am having an R-code where I need to assign 9k by 9k matrix. (assignment algorithm) In my optimization test part, while assigning as many task as possible (refer to Hungarian algorithm...

Excel MATCH statement nested in INDIRECT statement?

excel,nested,match
I have these two functions: =INDIRECT("A"& MATCH(A16,Sheet1!A:A,1)) =INDIRECT(J3&"! PUT FUNCTION 1 HERE ") Function 1 returns the value of cell A17, on Sheet 1 Function 2 SHOULD return the value of A17 on Sheet 2 (the second indirect function refers to cell J3, which contains "Sheet2". When I combine the...

Access Protected Members of a enclosing class [Nested Classes]

c++,class,nested,protected
I got the following code: class enclosing{ protected: int var1 = 2; int var2 = 4; public: class problem{ friend enclosing; public: void DoStuff(enclosing&e1){ int Sum = e1.var1 + e1.var2; } }i1; }e1; My question is, how do i access the protected member variables of the enclosing class? Is this...

How to iterate an object and build a new one

javascript,object,nested
I am using JavaScript to iterate customers in an object which is constructed as follows: [ { "customer": "Customer 1", "project": "1" }, { "customer": "Customer 2", "project": "2" }, { "customer": "Customer 2", "project": "3" } ] I wish to build a new object in iteration which would be...

Iterate with last element repeated as first in next iteration

python,list,nested,iteration
I have some list with objects looks like: oldList=[a,b,c,d,e,f,g,h,i,j,...] what I need is to create a new list with nested list items which will look like this: newList=[[a,b,c,d],[d,e,f,g],[g,h,i,j]...] or simply spoken - last element from previous nested is first element in next new nested list. ...

Creating a number list with nested For loops in Python

python,loops,nested
I've been working on this now for well over four hours and i've tried to check several resources. I'm trying to get something like this: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4...

C++ Nested class in class template declaration

class,templates,c++11,nested
I'm attempting to write a C++11 linked list implementation, with the linked list being a template class and its node being a nested class as follows: template <typename T> class LinkedList { public: class Node; std::shared_ptr<Node> listSearch(const T &input) const; private: std::shared_ptr<Node> head; std::shared_ptr<Node> tail; }; template <typename T> class...

nesting classes in Java and referencing them in static main

java,static,nested
If the class Animal is nested inside Test, I get the error: "non-static variable this cannot be referenced from a static context" Can you please explain this error and offer a way to make this code work, while still keeping nested classes? I'd like to learn to work with nested...

Write a NESTED LOOP code segment that produces this output

java,loops,nested
I know there is another thread with the same name, but the answer isn't really the one I'm looking for. I can only use for loops. The other answer uses complex syntax like: reverse = !reverse ? i == max : reverse; i = reverse ? i-1 : i+1; Can...

How to create nested list using special condition in python

python,list,nested,condition
I really appreciate an answer for my problem. So problem: I have a list Plist=[[x1,y2,str_1],[x2,y2,str_1],[x3,y3,str_1],[x4,y4,str_2],[x5,y5,str_2]] and would like to convert it into a nested list (would avoid dict now): newPlist=[[[x1,y2,str_1],[x2,y2,str_1],[x3,y3,str_1]],[[x4,y4,str_2],[x5,y5,str_2]]] I know how to sort it out based on length, yet cannot figure it out if I have a special...

SQL - Can I have a Group By clause after a nestled Select?

sql,select,group-by,nested,sql-function
For example: Select max(date) From table A Where max(date) < any (select.. ...) Group By Book_Name,Client_Name So the max(date) field could be compared to the Nestled Select return, as if the grouping of the greater Select was already made....

Nested grid does not stay expanded after insertion but not after PageIndexChanging event

javascript,c#,asp.net,gridview,nested
I have a nested grid staying in the expanded state after an insertion. I thought I could just apply the same logic in the PageIndexChanging event and it would work there also. But it is not. THis is my markup for my nested grid: <div id="div<%# Eval("GroupID") %>" style="display:none"> <asp:UpdatePanel...

Traversing nested javascript object to identify empty value properties

javascript,nested
If I had an object: var dog= { name: "Max", age: 5, sex: undefined, details: { color: "black", breed: undefined } } And I wanted to get the paths of the properties with undefined values. How could I iterate through all of the properties, including the nested ones? Currently, I...

How can I convert a hierarchical tree to parent-child relationships?

php,dynamic,menu,nested,hierarchical
At the moment, i'm creating a dynamic menu for my own CMS (practising) in PHP, but I don't know to save the data in my database. Database structure: menuitem_id menu_id menuitem_order menuitem_name menuitem_page_id parent_menuitem_id I do get this output as a hierarchical tree, but that isn't the desired format for...

Passing values from an array to child template in meteor

arrays,templates,meteor,static,nested
I've been grappling with the following problem: I have two templates: intervalsList intervalIcon I want intervalsList to populate with a list of intervalIcons. Each intervalIcon displays a number; there is an array of these numbers: [1, 5, 10, 15, 30, 45, 60] The intervalsList template iterates through this array, instantiating...

Nested if - JavaScript

javascript,html,nested,innerhtml
I want the code to read the input value for Bz and give a greeting along with the answer from the equation. This is what I have this far. It's not giving a 'greeting' after the computation. Help? <html> <body> <form id="function" onsubmit="return false" oninput="o.value = 3.21 + (9.63 *...

Understanding while in python

python,while-loop,nested
Good night, I have some idea about while functionality but I want to understand the why the variables inside its body refresh new values for the variables outside while body. Is something intrinsic of python? It was designed to be like that? num = int(input("Type a number: ")) while (num...

How to create nested SELECT COUNT with alias in Postgres

sql,postgresql,count,nested,alias
i'm writing the following SQL query for my Postgres database: SELECT( (SELECT count(*) as A FROM merchant WHERE nome LIKE 'A%'), (SELECT count(*) as B FROM merchant WHERE nome LIKE 'B%'), (SELECT count(*) as C FROM merchant WHERE nome LIKE 'C%'), (SELECT count(*) as D FROM merchant WHERE nome LIKE...

Nested chunksOf in Haskell?

list,haskell,nested
Say I want to do this: nestedChunksOf [3, 2] [1,1,1,2,2,2,3,3,3,4,4,4] == [[[1,1,1], [2,2,2]], [[3,3,3], [4,4,4]]] In Python, I can do this def group(a, *ns): for n in ns: a = [a[i:i+n] for i in xrange(0, len(a), n)] return a group([1,1,1,2,2,2,3,3,3,4,4,4], 3, 2) == [[[1,1,1],[2,2,2]],[[3,3,3],[4,4,4]]] But in Haskell, I can't just...

Nesting lists in python 2.7 (list of list)

python,list,nested
I need to create a list of lists. I've included some code leading up to where I am having problems. masterList at the bottom is the desired output. I have tried to explain my code and demonstrate the steps for a clear understanding. storeTask = list(islice((t for t in list5...

How to get a SASS nested nested media query to work with the use of the media query or operator

css,sass,nested,media-queries
I am trying to get a nested IE10+ media query to work in SASS and am not understanding the output. I think that things are getting weird with the use of the media query or operator ,. As a result, this query will not apply in all cases because the...

Rails - is it possible to have a shortcut within a model for its nested attributes?

ruby-on-rails,model,nested
This might be a stupid question but it's wracked my head for a while... So.. I have 2 models: (1) user, and (2) profile. The profile is associated to user via the following relationships: (1) user has_one :profile (2) profile belongs_to user It is the standard relationship for user and...

CDI Qualifier Inheritcance

java,nested,cdi,inherited
Is there a way I can do something like that in CDI: @Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Qualifier public @interface ServerConfiguration { @Nonbinding String url() default "http://localhost:8080"; @Nonbinding String username() default ""; @Nonbinding String password() default ""; } And then define a second annotation similar to that: @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @ServerConfiguration(username...

query_string filter inside a nested filter throws an error

elasticsearch,nested,filtering
In this example I've placed a full query example that's been paired down to the non-working portion that has me stuck. Basically we have a document that has a nested document type under datailItems and trying to do a query_string filter against a field in that nested document fails. I...

Javascript Calling a nested function from within itself

javascript,function,methods,nested,closures
If I run the following... function outer(){ function inner(){ } inner(); } inner will run the first time as expected. If I then try to run the following... function outer(){ function inner(){ inner(); } inner(); } inner will again run the first time as expected, but then fails at any...

Parsing nested XML using XMLin

xml,perl,parsing,nested
I spent a couple of hours trying to figure out how to make sense of this nested XML using XMLin but with no luck. I also tried the examples on this site; how can I get passed lca-data and iterate over prefix? Dumper output is here: http://pastebin.com/a4N8AtX1 Simple code: $url...

parsing multi object json in php [closed]

php,arrays,json,object,nested
hey guys I have the following sample data and I would like to parse it in php. Can you please direct me on how to get each value for "plate" and "confidence" in the candidate object in the data below. $sample_data = [{"job_status": 3, "plates": {"data_type": "alpr_results", "epoch_time": 1430894595648, "img_height":...

Python – Breaking out of a deeply nested loop with `while`, `try`, `if`, and `except` statements

python,if-statement,while-loop,nested,try-catch
Here is my code that solves a quadratic equation given user inputs a, b, c. However, I want to check for incorrect user inputs. If a user inputs anything but a float, the user is confronted with print "Not a valid input. Try again.\n" followed by a loop of the...

show values of parent row in ng-repeat

json,angularjs,nested
I'm a bit stuck here i have an array of 'parcel' objects, but i want to display a value of the parent object of this parcel how can i achieve this? i have created this fiddle: i would like to show also the buyer var myApp = angular.module('myApp', []); myApp.filter('createarray',...

Separate implementation and declaration with templates and nested types in C++

c++,templates,nested,implementation
If I keep the function Find() inlined, then the program compiles. Otherwise, as shown below, it does not compile. Is it possible to separate the declaration and implementation of such: ////////////////////////////////////////////////////////////////////////// template <class T> class MyClass { public: struct MyStruct { int id; T value; }; MyStruct *Find(int id); private:...

'Associated' data in ElasticSearch

elasticsearch,nested
For an ecommerce platform, we're looking to index products. Default fields are simple as: name_en, name_de, name_fr, description. But, price and stock are dependant on another value: Product A, for webshop 1, has price = 1.99, stock = 10, and fits under categories 1, 10, and 50. Product A, for...

Can Nested or Inner class by an @Entity in JPA?

nested,jpa-2.0
Can I and Should I make nested, inner classes an @Entity? For example: @Entity public class EnclosingOne { @Entity public class NestedOne extends EnclosingOne { } @Entity public static class InnerOne extends EnclosingOne { } } Or: public class EnclosingOne { @Entity public class NestedOne extends EnclosingOne { } @Entity...

Javascript nested / encapsulated prototype method

javascript,oop,nested,prototype,encapsulation
Is there any way to have Object prototype methods nested within an object's definition so that it keeps best readability? The main concern is the memory footprint involved, and efficiency. It's frustrating to come from a language like C# or even see that PHP has better object implementation (In My...

Partial specialization of nested template types produces “internal error” in VC++ 2012 compiler

c++,templates,visual-studio-2012,nested
In the following example, I have an object class which defines a reference class. Both accept mutability as a template argument. In the case that 'obj' is 'Const', I want to disallow a reference of type 'Non_Const'. The example produces the ambiguous message, "An internal error has occurred in the...

Can I write the following Django code more effectively? [closed]

django,loops,templates,object,nested
I have a couple of models - User & Score. I am displaying data from those models to my template. Data from Score is filtered based on data from User. I am using nested for loops and an if condition within the template to get my desired result. However, I...

Inner class declaration and initialization

java,class,object,nested,inner-classes
I am used to code in C++, but have to convert a project from C++ to Java. In C++ using data structure is pretty much simple. I am trying to replicate the same thing, but such as a Java inner class and static nested class. After reading several examples online,...

jQuery select or hide deeply nested div within a div with a class

jquery,nested,selector
I'm looking to hide a deeply nested div (with a class or ID name) within a container div with only class name. The container div is generated by an application so I cannot set an ID on it. I don't know exactly how many levels the div is generated so...

How to initialise nested structs in go? [duplicate]

struct,go,nested
This question already has an answer here: Initialize a nested struct in Golang 3 answers Hi I am very new to Golang, please help me. I have defined a struct inside a struct. But I get an error when I try to initialise the main struct. type DetailsFilter struct...

For loop enumerate. Python

python,json,dictionary,nested,enumerate
Right now I have a JSON with a list containing two dictionaries. This code allows the user to search through the list via index number, retrieving a dictionary. Currently I get two printed results one for each dictionary, for example if I typed the index number 1, I get: No...

Using varibles of a class inside nested classes in Python

python,class,logging,nested
I want something like this. I cannot pass pass the parent instance to Child class class Outer: def __init__(self, logging): self.logging self.logger = logging.getLogger('Parent') class Inner(SomeBaseClass): def __init__(self, *args): Outer.logger.info('initializing Child with %', ' '.join(args)) logging.config.fileConfig('logging.conf') outerObject = Outer(logging) . . . # both inner1 and inner2 use same logger...

How to access nested arrays in a JSON object (Android)

android,arrays,json,object,nested
The structure of my JSON is, "posts":[ //Post 1. { "images":{ "small":{ "url": "http://..." "width": 64 }, "large":{ "url": "http://..." "width": 128 } }, "caption":"..." }, { //Post 2 "images":{ "small":{ "url": "http://..." "width": 64 }, "large":{ "url": "http://..." "width": 128 } }, "caption":"..." } ] I want to get,...

Scheme nested lambda function

function,lambda,nested,scheme,sicp
I am a beginner in Scheme. I found this question in MIT exam 1 for SICP lecture. What's the value and type for – ((lambda (a) (lambda (b) (+ (sqrt a) (sqrt b)))) 5) I am having a hard time understanding how this function works. I am really confused about...

PHP - Build multiple-level HTML menu from php array combining like values based on value name

php,html,arrays,menu,nested
I have searched a bit on SO and haven't been able to find this unique use case, but maybe I don't know how to phrase it. I am looking to use a PHP array (see format below) to build a dynamic HTML menu that duplicates identical string values into sub...

R Nested For Loop for a Sensitivity Analysis

r,for-loop,nested,time-series
I'm fairly new to R and I've been trying for a while to do something, which I assumed to be very simple, but I keep failing at it (unfortunately for me, it doesn't mean it's not simple!). I have defined a function that takes a time series as an input...

Nested animation in iOS: combine animated and non-animated code in animateWithDuration?

ios,objective-c,animation,nested,animatewithduration
Nested animation In short the nested animation allows to run 2 independent animations simultaneously. But what to do if I have a complex code which consists of both animated and non-animated code? I mean the following situation: [UIView animateWithDuration:... animations:^{ ...//code1 - with animation ...//code2 - also contains code which...

Check if value exists in nested array

javascript,arrays,nested
If I have a nested array like this: "localValues" : [ { "localValId" : "e3rQACssGkfp9zsue", "localProductCode" : "271102502", "localMembersPrice" : 7814.090000000001, "localProductDescription" : "11R225 146/143L H DUN SP384 FM TL", "fetPr" : "29.39", "invPrice" : "353.85" }, { "localValId" : "NxtmZngRpGY56grkW", "localProductCode" : "290132910", "localMembersPrice" : "300", "localProductDescription" : "215/70R16...

decoding nested json objects in go

arrays,json,go,nested
I found some posts on how to decoding json nested objects in go, I tried to apply the answers to my problem, but I only managed to find a partial solution. My json file look like this: { "user":{ "gender":"male", "age":"21-30", "id":"80b1ea88-19d7-24e8-52cc-65cf6fb9b380" }, "trials":{ "0":{"index":0,"word":"WORD 1","Time":3000,"keyboard":true,"train":true,"type":"A"}, "1":{"index":1,"word":"WORD 2","Time":3000,"keyboard":true,"train":true,"type":"A"}, }, "answers":{...

JQuery: How to show current nested sub-menu and hide the others?

javascript,jquery,html,menu,nested
$('li').on('click', function(){ $('li').not(this).each(function(){ $(this).children('ul').addClass('hide'); }); $(this).children('ul').removeClass('hide'); }); Help me, please! I got several hours on this and I can't figure how to solve it. The code above it's for a horizontal multi-level menu. On click shows a sub-menu and hide all the other sub-menus, everything works fine until this point....

Is there a syntax for incomplete nested type without a forward declaration?

c++,c++11,nested,forward-declaration
The following program produces a diagnostic error. #include <memory> class Containing { // class Nested; // [1]: This line seems required. typedef std::shared_ptr<class Nested> Ptr; class Nested { Ptr & ptr (); void foo (const Ptr &p) { p->ptr() = ptr()->ptr(); // [2]: Error here without [1] } }; };...

AngularJS - Display complex JSON data with a single ng-repeat

javascript,json,angularjs,nested,ng-repeat
I am trying to display all the books of some series. I used nested ng-repeat and it works well. However, due to some recent changes on layout requirements, I cannot use nested ng-repeat (I want a single list of books). I would expect something like below <ul> <li>book1 of series1</li>...

Angular Nested ng-repeats with json call not working

json,angularjs,nested,angularjs-ng-repeat
I am attempting to make a nested list like this using ng-repeat and a json file: [] Pizza King North Region [] Pizza King 102 [] Pizza King 103 [] Pizza King 104 [] Pizza King South Region [] Pizza King 201 [] Pizza King 202 [] Pizza King East...

Rails nested variables without more models

ruby-on-rails,model,nested
I'm using Rails 4 and have a Policy model. This model has a ton of attributes that I would like to organize in sub-groups of sorts. This is an example: A policy has base information such as name, address, type. Is there a way to organize the model such that...

Accessing different level nested JSON values in jquery in same function

javascript,jquery,json,object,nested
What I'm trying to achieve: 1. a page with two drop down lists and a submit button; 2. when user selects values in one or both drop lists and clicks on submit; 3. system checks JSON file (extracted from Facebook Graph API) and displays results with the values selected in...

Python - Nested Lists

python,list,nested,iteration
I'm trying to cross check two nested list values, and if I get a match, append the values from list1 into list2. For example; list1 = [[ip, hostname], [ip, hostname], [ip, hostname]] list2 = [[ip, ip_upper, type, hostname, location], [ip, ip_upper, type, hostname, location], [ip, ip_upper, type, hostname, location]] I...

Can someone explain to me why this nested loop function print this way?

java,loops,nested
So here is the code that runs: public static void main(String[] args) { for (int i=1; i<=6; i++) { for (int j=1; j<=i; j++) System.out.print("*"); System.out.print("-"); } } why does it print *-**-***-****-*****-******- instead of * _ ** __ *** ___ **** ____ *****_____******______ ...

Pandoc - HTML to Markdown not processing nested unordered lists correctly

html,nested,html-lists,markdown,pandoc
I am trying to convert a nested unordered HTML list to Markdown using Pandoc. The nested list in the HTML document is in the format: <ul> <li>outer list item</li> <li>outer list item</li> <li>outer list item</li> <ul> <li>inner list item</li> <li>inner list item</li> <li>inner list item</li> </ul> <li>outer list item</li> <li>outer...

C++11 cannot resolve nested namespace

c++,namespaces,nested
say I create a class Foo in foo.h under namespace Fooo like follows: foo.h: namespace Fooo { class Foo { }; } and its corresponding source file: foo.cpp: namespace Fooo { Foo::Foo() { } } I write another source file util.cpp to create some utility functions for the Foo class...

decltype does not resolve nested vectors. How can I use templates for nested vectors?

c++,templates,vector,nested
I am trying to overload the + operator to deal with nested vectors. I thought the function would call itself until the nested vectors resolve to basic types, but instead I get a huge list of errors when I compile it. My vector operations that I have defined work for...

How to use parameters from data frame in R and loop through time holding them constant

r,nested,time-series,lapply,sapply
I have a function (weisurv) that has 2 parameters - sc and shp. It is a function through time (t). Time is a sequence, i.e. t<-seq(1:100). weisurv<-function(t,sc,shp){ surv<-exp(-(t/sc)^shp) return(surv) } I have a data frame (df) that contains a list of sc and shp values (like 300+ of them). For...

Trouble getting PrintWritter to correctly print to .txt after my nested loop

java,nested,printf,printwriter
I'm asked to use PrintWriter to print grids of multiplication problems to a .txt file. Everything is working well but I'm having some serious trouble with getting my code to print the way I'm asked. I've been using printf with left/right indentation. Any help would be very appreciated. I didn't...

Keep input order in nested dictionaries

python,dictionary,order,nested
How can I preserve the input order of nested dictionaries? Specifically: I use another dictionary to make it the nested dictionary of an ordered dict (named 'outdict'), and then I add new keys. Example data: example1 = {'x': '28', 'y': 9,'z': '1999'} example2 = {'x': '12', 'y': 15,'z': '2000'} test1...

Rails nested forms -> different treatment depending on value

ruby-on-rails,forms,nested
I have this tricky question regarding nested forms. Just say I have the following models: restaurant employees, in which employees belongs_to restaurant. I also have two types of employees within the employees model, managers staff The managers are designated via manager attribute in the employees model, it is a boolean....

Output in nested loops

java,loops,nested,bluej
I'm trying to get this output: 123454321 1234 4321 123 321 12 21 1 1 I have tried doing this first: 12345 1234 123 12 1 Then,putting a '\t' and putting this next to the above: 4321 4321 321 21 1 ...

Using ifelse Within apply

r,if-statement,nested,data.frame,apply
I am trying to make a new column in my dataset give a single output for each and every row, depending on the inputs from pre-existing columns. In this output column, I desire "NA" if any of the input vales in a given row are "0". Otherwise (if none of...

Reading from dictionaries nested in a list

python,list,dictionary,nested,enumerate
I am relatively new to Python so bare with me. [ { "wrong3": "Nope, also wrong", "question": "Example Question 1", "wrong1": "Incorrect answer", "wrong2": "Another wrong one", "answer": "Correct answer" }, { "wrong3": "0", "question": "How many good Matrix movies are there?", "wrong1": "2", "wrong2": "3", "answer": "1" } ]...

nested ajax parent completed before child had finished

jquery,ajax,json,nested
$.ajax( { type: 'POST', url: [email protected]("EkranListeleSektor")', dataType: 'json', async: false, //added async later, no changes data: { sektorID: $("#ekranSektorID").val() }, success: function (items) { $.each(items, function (i, ekranlar) { $.ajax({ type: 'POST', url: [email protected]("IlAdGetir")', dataType: 'json', data: { id: ekranlar.il }, success: function (ilAd) { strIlAd = ilAd; }, error:...

Does a Do-While loop break a For Each-Next Loop?

vba,excel-vba,loops,nested
I'm trying to make sure that a range has visible rows before I act on those visible rows (delete them) because if I try to act on a filtered range when there aren't any visible rows there, I'll get an error. Dim lastrow As Integer Dim ws as Worksheet For...

Display mongodb multiple group by query results in a nested format

mongodb,group-by,nested,aggregate,multiple-columns
Given the following dataset: [ { "account_id" : "1111" "task_id" : "aaaa", "workweek" : "20", "hours": "18" }, { "account_id" : "1111" "task_id" : "aaaa", "workweek" : "20", "hours": "12" }, { "account_id" : "1111" "task_id" : "aaaa", "workweek" : "21", "hours": "10" }, { "account_id" : "1111" "task_id" :...

How to display “ALL” the nested documents in an object in separate rows from elasticsearch?

elasticsearch,nested,elasticsearch-plugin
I have a nested object in the following form: { "name": "Multi G. Enre", "books": [ { "name": "Guns and lasers", "genre": "scifi", "publisher": "orbit" }, { "name": "Dead in the night", "genre": "thriller", "publisher": "penguin" } ] } I tried the following JSON query for the above document: {...

Inject a template in parent's view with ui-router

angularjs,nested,angular-ui-router,state
I have an abstract state declared as $stateProvider.state('myapp', { abstract: true, templateUrl : 'index.html' }); And all the <ui-view> in the 'index.html' template will be populated by the children states: $stateProvider.state('myapp.home', { url : "/", views : { "main" : { controller : 'HomeCtrl', templateUrl : 'includes/home.html' } } });...

Mathematical equivalent of multiple nested loops

java,c,for-loop,nested,mathematical-expressions
When you have loop in the loop or nested loop, let`s say for-loop, regardless of the programming language(of course must be imperative) for(int j = 1; j <= 100; j++){ for(int k = 1; k <= 200; k++){ \\body or terms } } is the mathematical equivalent, when I want...

How do I to add object collection to an object variable collection? [duplicate]

c#,asp.net,collections,nested,nullreferenceexception
This question already has an answer here: What is a NullReferenceException and how do I fix it? 17 answers I have a nested collection in side an object: public class Question { public AnswerObjectCollection Answers { get; private set; } } When I try to add answers to the...

Golang Decode Nested JSON into Nested Struct

json,curl,struct,go,nested
I must be doing something wrong here. I've seen all the stackoverflows and my code doesn't look wrong to me..however, I'm not getting a good decoding of the the nested struct for some reason. Here's a snipit: type Input struct { Value1 string Value2 string Value3 string Value4 string Nest...

inline lists with block nested list's for a menu

jquery,html,css,list,nested
I am trying to create a menu that looks like this I am using nested lists that come from three db tables to create a list in this DEMO how do I lay out the sub menus to fit under the top menus without the top menu items moving when...

AngularJS - Filter out single object in nested data structure

angularjs,filter,nested,ng-repeat
Data var data = { "records": [ { "name": "Spectrum Series", "seriesid": "SpectrumSeries", "book": [ { "name": "White Curse", "bookid": "WhiteCurse", "image": "book1" }, { "name": "Blue Fox", "bookid": "BlueFox", "image": "book2" } ] … other series } Controller dnleoApp.controller('BookCtrl', function ($scope, $routeParams) { $scope.mybookid = $routeParams.bookid; $scope.myseriesid = $routeParams.seriesid;...

ConcurrentModificationException when removing item in nested loops

java,loops,nested,concurrentmodification
This is my code, and I obtained a ConcurrentModificationException when I removed an element. I do not understand why itrGrupo1 is affected by removing an element in itrGrupo2. The exception occurs at: Instancia inst1=(Instancia) itrGrupo1.next() when the second while is finished. for (int i=0; i<lstPrimeraAgrupacion.size();i++){ List grupo1=new ArrayList(); List grupo2=new...

Elasticsearch data model

data,elasticsearch,model,nested,parent-child
I'm currently parsing text from internal résumés in my company. The goal is to index everything in elasticsearch to perform search on them. for the moment I have the following JSON document with no mapping defined : Each coworker has a list of project with the client name { name:...

Nested promises in ui-router resolve

angularjs,nested,angular-ui-router,promise,resolve
I have been struggling for a while with the following problem: I would like to get some data before the view shows, (resolve). But some of the data is dependend on the result of another promise. It goes like this: I get the job id (index) from the $stateParams and...

Angular ui.router. Deep nested routes

angularjs,nested,angular-ui-router,state
Here is an example to check http://embed.plnkr.co/uVMlkk/preview When we navigate to 'page2' route there is a 'hey, I'm a subroute' note. But once we navigate anywhere else that note will disappear forever. The goal is to make some nested states to be shown right away (as a default ones). I...

How to build a nested ordered dict from a csv?

python,csv,dictionary,nested,ordereddictionary
How can I get a nested dictionary, where both the keys and the subkeys are precisely in the same order as in the csv file? I tried import csv from collections import OrderedDict filename = "test.csv" aDict = OrderedDict() with open(filename, 'r') as f: csvReader = csv.DictReader(f) for row in...

Nested Hashmaps overwriting other keys

java,hashmap,nested
I have a problem where when I want to change a value in a nested HashMap, the other HashMaps are being overwritten. for example I have a key name Alligator, which stores a HashMap that contains the keys Weight and Size. I want to be able to change the value...

Implementing nested If-cycles in a winform

c#,winforms,nested
For example I have a nested if-cycle in console like if (answer == "one") { Console.WriteLine("one or two?"); string answer = Console.ReadLine(); if (answer == "one") { Console.WriteLine("pressed1"); } else Console.WriteLine("pressed2") //....and so on } Everything works fine. But if I try to do the same in winform, it turns...

Nested if loop with DataFrame is very,very slow

python,if-statement,nested,dataframes
I have 10 million rows to go through and it will take many hours to process, I must be doing something wrong I converted the names of my df variables for ease in typing Close=df['Close'] eqId=df['eqId'] date=df['date'] IntDate=df['IntDate'] expiry=df['expiry'] delta=df['delta'] ivMid=df['ivMid'] conf=df['conf'] The below code works fine, just ungodly slow,...

JQuery: How to add a class to nested elements, one by one?

jquery,html,list,menu,nested
Ok, I'm creating a multilevel menu, when one sub-menu is open all the others are closed, except if the sub-menu has another sub-menu nested to it, in this case all the others sub-menus are closed except for the parent and the current sub-menu. I do the trick with this code:...

Nested grid does not stay expanded after PageIndexChanged event [duplicate]

javascript,gridview,nested
This question is an exact duplicate of: Nested grid does not stay expanded after insertion but not after PageIndexChanging event 1 answer I am trying to figure out how to keep my nested grid expanded after I move to the next page. This is my markup: <asp:ScriptManager ID="scriptMger" runat="server"></asp:ScriptManager>...

Parsing complex nested JSON data with Gson

java,json,object,nested,gson
I'm using Gson to parse a JSON string. I want to convert this to an object using a container class and embedded static classes. To some extent this has been possible, but I want to treat the content of stuff1 and stuff2 as arrays, for example, stuff1 is an array...

Route does not match in jquery with custom action

jquery,ruby-on-rails,routes,nested
I have custom controller actions called #load and #save called schedules_controller. I also have Boat Model, where Boat has_many: schedules and Schedule belongs_to :boat. Here is the routes.rb; resources :boats, except: :destroy do post '/schedules/load' => 'schedules#load' post '/schedules/save' => 'schedules#save' end When I use this routes rake gives; boat_schedules_load...