hierarchy

How to group tests using specs2?

烂漫一生 提交于 2019-12-05 04:23:39
I'm used to JUnit, in JUnit it is possible to group several tests (usually related to a class) just by defining these tests in a single file (class) and annotating them with @Test . Then, to run several of these tests, a TestSuite is created with @Suite.SuiteClasses and so on. In specs2 it is possible to group several tests at two different levels extending some Specification . For example: "Whatever" should { "do its job when possible" in { whatever(new Thing).work must beSome } "return none when not possible" in { whatever(null).work must beNone } } We can group several Specification of this

solr geography hierarchy

老子叫甜甜 提交于 2019-12-05 02:24:41
问题 I've been trying to figure out a way to implement faceting with hierarchies in solr and can't figure out how to do it in my situation. I've read a couple of the articles on doing hierarchies in solr along with the solutions in patch 64 and 792. The main issue I'm having is that I have entities that can belong to multiple branches of the hierarchy. The current form of my data is a user document with MVAs for country, state, and city. Take for instance a geographical hierarchy that people can

Linq to Sql - Hierarchical Query to Find Ancestors

谁说胖子不能爱 提交于 2019-12-05 01:32:58
问题 Given an EmployeeId, how can I construct a Linq to Sql query to find all of the ancestors of the employee? Each EmployeeId has an associated SupervisorId (see below). For example, a query of the ancestors for EmployeeId 6 (Frank Black) should return Jane Doe, Bob Smith, Joe Bloggs, and Head Honcho. If necessary, I can cache the list of all employees to improve performance. UPDATE: I've created the following crude method to accomplish the task. It traverses the employee.Supervisor relationship

In Ruby, how does a class defined in a module know the module's constants?

被刻印的时光 ゝ 提交于 2019-12-05 01:00:29
问题 I'm trying to understand how a class defined in a module knows the module's constants. Here's an example of what I mean: module Car class Wheel end class Seat p Wheel # Car::Wheel end end I know it's obvious, but since Wheel is nowhere in Seat's hierarchy, I don't understand how it can have access to it. 回答1: If you reference a class constant, Ruby will look for it first in the same module, and then on the root if it's not found there. So, since both Seat and Wheel are in the Car module, if

Setting property value on child instance to a fixed value with Autofixture

让人想犯罪 __ 提交于 2019-12-04 22:34:23
Is it possible to assign a fixed value to a property on a child instance when building a parent with Autofixture? It will add default values to all the properties on the child instance like a charm, but I would like to override and assign a specific value to one of the properties on the child instance. Given this parent/child relationship: public class Person { public string FirstName { get; set; } public string LastName { get; set; } public Address Address { get; set; } } public class Address { public string Street { get; set; } public int Number { get; set; } public string City { get; set; }

SQL: How to select all parent nodes in Materialized path?

故事扮演 提交于 2019-12-04 21:02:46
The MySQL databse stores tree with the help of materialized path data structure. How to select all parents of the given node? I use dot '.' as path separator, and database structure includes 'level' field that indicates the depth of a node in the tree. Lets I have those tree and need all parents of the node 'a.b.d.e': id | path a | a b | a.b c | a.b.c d | a.b.d e | a.b.d.e f | a.f The script should return: a a.b a.b.d a.d.d.e (optional) How to do that in MySQL? Ivan Z I've found the solution in the question posted by @quambo . Here it is: SELECT * FROM table WHERE ? LIKE id||% ORDER BY path

Moving a git repository down a hierarchy level

≯℡__Kan透↙ 提交于 2019-12-04 19:18:04
问题 I was searching for hours now but couldn't find a satisfying answere even though it appears to be simple noobish question. What I basically want to accomplish is to move my .git directory which currently resides besides my project folder down into the project folder. Optimally this shouldn't alter the repository history at all although I don't know whether this is actually possible. The reason I want to do this a somewhat IDE/project-type related problem I can solve this way. I appreciate any

How to set parentViewController in UIViewController?

廉价感情. 提交于 2019-12-04 17:52:03
问题 The parentViewController property of UIViewController is readonly, but I am nesting custom view controllers and would like to use this property. However, since it is readonly, and I found no other way to set this property, my quesion is: how do I set it? Obviously, UINavigationController can set the property somehow in -pushViewController, and so can -presentModalViewController, so it must be possible. I am aware that I can just add my own UIViewController property, but I'm sure that

Build hierarchical html tags in PHP from flat data

大兔子大兔子 提交于 2019-12-04 17:44:49
How do you build a hierarchical set of tags with data in PHP? For example, a nested list: <div> <ul> <li>foo </li> <li>bar <ul> <li>sub-bar </li> </ul> </li> </ul> </div> This would be build from flat data like this: nested_array = array(); nested_array[0] = array('name' => 'foo', 'depth' => 0) nested_array[1] = array('name' => 'bar', 'depth' => 0) nested_array[2] = array('name' => 'sub-bar', 'depth' => 1) It would be nice if it were nicely formatted like the example, too. Edit: Added formatting As already said in the comments, your data structure is somewhat strange. Instead of using text

How to query and parse adjacent list hierarchy using cte?

瘦欲@ 提交于 2019-12-04 16:57:34
How can I query this parent-child hierarchy to produce a result set in which the levels are in their own columns? Sample data: SET NOCOUNT ON; USE Tempdb; IF OBJECT_ID('dbo.Employees', 'U') IS NOT NULL DROP TABLE dbo.Employees; CREATE TABLE dbo.Employees ( empid INT NOT NULL PRIMARY KEY, mgrid INT NULL REFERENCES dbo.Employees, empname VARCHAR(25) NOT NULL, salary MONEY NOT NULL, CHECK (empid <> mgrid), CHECK (empid > 0) ); CREATE UNIQUE INDEX idx_unc_mgrid_empid ON dbo.Employees(mgrid, empid); INSERT INTO dbo.Employees(empid, mgrid, empname, salary) VALUES (1, NULL, 'David' , $10000.00), (2,