小编gre*_*rth的帖子

C#LINQ.没有处理DocumentDb CreateDocumentQuery

我正在尝试查询具有某种类型产品的Art.这是我的艺术模型:

  public string Title { get; set; }
  public string Description { get; set; }
  public List<Product> Products { get; set; }
  public string PaintedLocation { get; set; }
Run Code Online (Sandbox Code Playgroud)

从这里我所做的就是以下LINQ查询:

List<Art> items = DocumentDbHelper.Client.CreateDocumentQuery<Art>(collection.DocumentsLink)
                               .Where(i => i.type == "art")
                               .Where(i => i.Products.Any(p => p.Name == productType))
                               .AsEnumerable()
                               .ToList();
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

"Method 'Any' is not supported."
Run Code Online (Sandbox Code Playgroud)

我去了代码引用的页面,看看支持什么,但我没有看到它说不支持Any(),所以我可能做错了.任何帮助表示赞赏.

UPDATE

这对我来说真的很奇怪,所以我把它拆开来看看从两个结果中返回的是什么来更好地调试问题:

        List<Art> items = DocumentDbHelper.Client.CreateDocumentQuery<Art>(collection.DocumentsLink)
                               .Where(i => i.Id.Contains("art"))
                               .AsEnumerable()
                               .ToList();

        items = items.Where(i => i.Products.Any(p => p.Name == productType))
                     .AsEnumerable()
                     .ToList();
Run Code Online (Sandbox Code Playgroud)

由于某些原因,这不起作用,因为我将它转换为列表,因此我正在运行查询两次 …

c# linq azure azure-cosmosdb

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

Git克隆无法正常工作 - 错误443

我在家工作,我正在尝试克隆来自Github的回购,并收到以下错误:

git clone https://github.com/account/repo.git
Run Code Online (Sandbox Code Playgroud)

也试过了

git clone git://github.com/account/repo.git

Error: Failed connect to github.com:443; No error while accessing https://github.com/account/repo/info/refs?service=git-upload-pac
fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)

我甚至尝试使用SSH,这就是我得到的:

ssh:连接到主机github.com端口22:错误的文件号致命:无法从远程存储库读取.

我只能在我的笔记本电脑上克隆它,所以我知道我有正确的权限,我只是需要帮助试图弄清楚为什么在我的桌面上发生这种情况似乎所有其他建议似乎都没有工作.

  • 我没有使用代理.
  • 我也不能对已经存在的其他回购做些什么.

编辑 确定我运行了建议的命令,结果如下:

$ ssh -i ~/.ssh/id_rsa -vvv git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug2: ssh_connect: needpriv 0
debug1: Connecting to github.com [204.232.175.90] port 22.
debug1: connect to address 204.232.175.90 port 22: Not owner
ssh: connect to host github.com port 22: Bad file number
Run Code Online (Sandbox Code Playgroud)

有什么建议?

git github

8
推荐指数
1
解决办法
1万
查看次数

在Python中更新并创建一个多维字典

我正在解析存储各种代码片段的JSON,我首先构建这些片段使用的语言字典:

snippets = {'python': {}, 'text': {}, 'php': {}, 'js': {}}
Run Code Online (Sandbox Code Playgroud)

然后当循环通过JSON我想要将关于该片段的信息添加到它自己的字典中到上面列出的字典.例如,如果我有一个JS片段 - 最终结果将是:

snippets = {'js': 
                 {"title":"Script 1","code":"code here", "id":"123456"}
                 {"title":"Script 2","code":"code here", "id":"123457"}
}
Run Code Online (Sandbox Code Playgroud)

不要混淆水域 - 但是在PHP中使用多维数组我会做以下事情(我正在寻找类似的东西):

snippets['js'][] = array here
Run Code Online (Sandbox Code Playgroud)

我知道我看到一两个人在谈论如何创建一个多维字典 - 但似乎无法追踪在python中向字典添加字典.谢谢您的帮助.

python dictionary multidimensional-array

7
推荐指数
2
解决办法
3万
查看次数

即使表位于表属性下,Dexie.js table.name 也不起作用

我想将表中的所有项目提取到集合中,但出现表名称为undefined. 这是我的商店:

db.version(1).stores({
  users: '++id,',
  orgs: '++id,',
  applications: '++id'
})
Run Code Online (Sandbox Code Playgroud)

后来这是我的电话:

db.orgs.toCollection().count(function (count) {
   console.log(count)
})
Run Code Online (Sandbox Code Playgroud)

它给出了以下错误:

TypeError: Cannot read property 'toCollection' of undefined
Run Code Online (Sandbox Code Playgroud)

但是当我在调用时停止调试器并输入db.tables足够的内容时:

1:Table {name: "orgs", schema: TableSchema, _tx: undefined, …}
_tx:undefined
hook:function rv(eventName, subscriber) { … }
name:"orgs"
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏 - 谢谢。

更新

我注意到当我在初始创建时为数据库播种时,我可以取出数据。所以我将该代码复制到我的模板中。然而,它仍然失败了,所以一定有一些简单的东西我错过了,这是代码:

import Dexie from '@/dexie.es.js'

export default {
  name: 'ListOrgs',
  data: () => {
    return {
      orgs: []
    }
  },
  methods: {
    populateOrgs: async function () {
      let db = await …
Run Code Online (Sandbox Code Playgroud)

vue.js dexie

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