小编use*_*696的帖子

使用Azure Management C#API创建资源组

有没有办法使用Azure Management C#API创建资源组?

基本上这个REST API调用:https: //msdn.microsoft.com/en-us/library/azure/dn790525.aspx

我找到了一种使用client.AffinityGroups.Create创建Affinity Group的方法,但这是我发现的最接近的东西.

c# azure

5
推荐指数
1
解决办法
4437
查看次数

Neo4j Cypher查询与层次关系

我有一个包含一些电影的数据库.电影在具有层次结构的区域中发布.层次结构如下(全局) - [包含] - >(欧盟),(全局) - [包含] - >(美国),(欧盟) - [包含] - >(英国),(欧盟) - [包含] - >(SE).

我想要一个Cypher查询,它将返回我所在地区的电影版本,或者层次结构中较高层的其中一个区域.

如果我在英国并且在英国和欧盟发行了一部电影,我想仅返回英国版本.如果它在欧盟发布,但没有特定的英国版本,我想退回欧盟版本.

问题是如何避免重复.

我的数据有这样的结构,我想为每部电影返回一个版本

(Movie1)-[has_release]->(release1)-[has_region]->(EU) 
(Movie1)-[has_release]->(release2)-[has_region]->(Global)
(Movie2)-[has_release]->(release3)-[has_region]->(UK)
(Movie2)-[has_release]->(release4)-[has_region]->(US)
Run Code Online (Sandbox Code Playgroud)

在这种情况下,当我在英国查询电影时,我想返回release1(和release3),因为EU与英国有包含关系,但我不想返回release2,因为它已经找到了发布了Movie1,所以我想将与区域层次结构最接近的版本返回到UK,在本例中为EU.

neo4j cypher

4
推荐指数
1
解决办法
506
查看次数

密码中的嵌套 has_many 关系

我有一个嵌套的 has_many 关系,我试图将其映射到 json 结果。

博客中的以下示例显示了我想做的事情,但它不是嵌套的

 MATCH (a:Person { name: "Andres" })-[:FATHER_OF]->(child)
  RETURN 
  {name:a.name, kids:collect(child.name)} as document
Run Code Online (Sandbox Code Playgroud)

我想要的是这样的

 MATCH (a:Person { name: "Andres" })-[:FATHER_OF]->(child)-[:has_read]->(book)-[:has_chapter]->(chapter)
  RETURN 
  {name:a.name, kids:collect({"name":child.name, has_read:collect(book)})} as document
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我想返回一个结构如下的 json 对象:

{
  "name": "Andres"
  "kids": [
           {
             "name":"Bob"
             "has_read": [
                           {
                            "name":"Lord of the Rings",
                            "chapters": ["chapter1","chapter2","chapter3"]
                           },
                           {
                            "name":"The Hobbit",
                            "chapters": ["An unexpected party","Roast mutton"]
                           }
                         ]
           },
           {
             "name":"George"
             "has_read": [
                           {
                            "name":"Lord of the Rings",
                            "chapters": ["chapter1","chapter2","chapter3"]
                           },
                           {
                            "name":"Silmarillion",
                            "chapters": ["chapter1","chapter2"]
                           }
                         ]
           } …
Run Code Online (Sandbox Code Playgroud)

neo4j cypher

2
推荐指数
1
解决办法
1271
查看次数

使用rx以随机时间间隔生成数字

如何使用Rx.Net生成一个数字列表,如0-100,其中每个数字是随机生成的?

编辑:

看起来像是这样的

    public void NonBlocking_event_driven()
    {
        var random = new Random();
        var ob = Observable.Create<int>(
        observer =>
        {
            timer.Interval = 1000;
            timer.Elapsed += (s, e) => observer.OnNext(random.Next(0, 3));
            timer.Elapsed += OnTimerElapsed;
            timer.Start();
            return Disposable.Empty;
        });
        var subscription = ob.Subscribe(UserAction);
        Console.ReadLine();
        subscription.Dispose();
    }
    private void OnTimerElapsed(object sender, ElapsedEventArgs e)
    {
        var random = new Random();
        timer.Interval = random.Next(1, 10)*1000;
        Console.WriteLine(e.SignalTime);
    }
Run Code Online (Sandbox Code Playgroud)

system.reactive

2
推荐指数
1
解决办法
1098
查看次数

标签 统计

cypher ×2

neo4j ×2

azure ×1

c# ×1

system.reactive ×1