小编And*_*eas的帖子

如何通过方法返回DocumentSnapShot?

带有(DocumentSnapShot documentsnapShot)参数的自定义对象.也是来自Firebase的内部对象,它检索快照并将值设置为我的自定义模型也有其参数(DocumentSnapShot documentsnapShot).但是,我希望从Firebase获取数据并将其传递给我的自定义参数,因为我不仅会获取Firebase的多个数据.如果没有覆盖,就不可能迭代Firestore.

这是代码:

public UserSettings getUserSettings(DocumentSnapshot documentSnapshot){
    Log.d(TAG, "getUserSettings: retrieving user account settings from firestore");

    DocumentReference mSettings = mFirebaseFirestore.collection("user_account_settings").document(userID);
    mSettings.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
        @Override
        public void onSuccess(DocumentSnapshot documentSnapshot) {
            UserAccountSettings settings = documentSnapshot.toObject(UserAccountSettings.class);
            settings.setDisplay_name(documentSnapshot.getString("display_name"));
            settings.setUsername(documentSnapshot.getString("username"));
            settings.setWebsite(documentSnapshot.getString("website"));
            settings.setProfile_photo(documentSnapshot.getString("profile_photo"));
            settings.setPosts(documentSnapshot.getLong("posts"));
            settings.setFollowers(documentSnapshot.getLong("followers"));
            settings.setFollowing(documentSnapshot.getLong("following"));
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

java android firebase google-cloud-firestore

13
推荐指数
2
解决办法
3352
查看次数

我可以从我的msbuild脚本中取消TeamCity构建吗?

TeamCity允许我使用## teamcity交互从我的MsBuild脚本报告.我可以使用它来告诉TeamCity构建已经失败,或者确实已经成功,但是我想告诉它取消构建.有谁知道这样做的方法?

我可以用它来告知TeamCity失败......

<Message Text="##teamcity[buildStatus status='FAILURE']" Condition="Something==SomeCondition" />
Run Code Online (Sandbox Code Playgroud)

我很乐意这样做......

<Message Text="##teamcity[buildStatus status='CANCEL']" Condition="Something==SomeCondition" />
Run Code Online (Sandbox Code Playgroud)

我已经尝试过TeamCity服务任务,但到目前为止还没有.

编辑:

因此,虽然可以使用解决方法http请求取消构建,但似乎此功能不可用.还有一个功能请求取消构建TC网站.如果这是你想要的东西(或者想帮助我吗?)那么投票吧!

干杯

msbuild teamcity

10
推荐指数
1
解决办法
1947
查看次数

HTML5视频无法播放

我为HTML5尝试了一个简单的例子,但它似乎没有用.

<!DOCTYPE html>
<html>

<body>
  <video width="320" height="240" controls="controls">
    <source src="resources/sample/sample1.m4v" type="video/mp4" />
  </video>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

我在chrome上尝试了这个例子,视频加载,但它没有播放,我可以看到视频帧,如果我来回移动滑块,但视频本身不播放.

更新:我在localhost(tomcat)上访问它,它仍然以相同的方式作出反应.另外我注意到我无法在chrome或firefox上播放任何HTML5视频(更新).

html5

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

如何从上次提交中删除某些行并将它们添加到 git 中的新提交中?

在我的上次提交中,我在文件中添加了某些行,这些行应该作为单独的提交添加。如何仅撤消提交中的那些行而不完全删除它们(因为我仍然需要稍后添加它们)?

我知道我可以git reset HEAD~1完全撤消提交,然后git add -p仅添加我需要的行,然后再次提交。我实际上正在寻找一种更清洁的解决方案(如果存在)

git

7
推荐指数
1
解决办法
6302
查看次数

无法从 Django 应用程序调用 Celery 任务(缺少位置参数)

好吧,我已经翻遍了所有 SO 帖子、Celery 文档等……但我就是想不通。无论我尝试什么或如何尝试从 Django 应用程序调用任务,Celery 都在抱怨我没有提供所需的参数。

“类型错误:add() 缺少 2 个必需的位置参数:'x' 和 'y'”。

我正在从他们的文档中遵循一个非常简单的示例……仅使用延迟,例如:

add.delay(1, 2)
Run Code Online (Sandbox Code Playgroud)

仍然是同样的错误。我也尝试过add.delay(x=1, y=2)celery.send_task("add", [1, 2])以及各种各样的其他方式,我见过在各种帖子中调用的任务,但都没有工作。

方法非常简单:

@shared_task
def add(x, y):
    return x + y
Run Code Online (Sandbox Code Playgroud)

我也试过它的名字,例如:

@task(name="my_add")
def add(x, y):
    return x + y
Run Code Online (Sandbox Code Playgroud)

结果一样。我还能缺少什么?

python django task delay celery

6
推荐指数
1
解决办法
2907
查看次数

Ruby - 块何时执行?

我了解 ruby​​ 的block工作原理。

block_test.rb

def foo
  yield if block_given?
end

my_block = foo { puts "hello" }
Run Code Online (Sandbox Code Playgroud)

如果我跑,ruby block_test.rb. 当然,它会按您的预期打印“你好”。

hello
Run Code Online (Sandbox Code Playgroud)

但我的问题是我什么时候执行了 ruby​​ 块?我没有在任何地方调用 foo 方法。

我没有写——foo()诸如此类。

# I defined `foo` method here as [If a block has been given, execute it.] but did not call.
def foo
  yield if block_given?
end

# I also defined block of `foo` as [print 'hello'] and store into `my_block` variable. 
# But I did not say execute …
Run Code Online (Sandbox Code Playgroud)

ruby closures block

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

“找不到该应用。” 在控制台中运行heroku命令时

I'm trying to run commands for my heroku app in my console, but it keeps telling me "Couldn't find that app." even though when I run heroku apps in my console it tells me I have one app called worldofwarcraft-api

So heroku recognizes my app in the apps list, but I can't run any commands to access it. The line I want to run is

heroku ps:scale web=1 --app worldofwarcraft-api
Run Code Online (Sandbox Code Playgroud)

I'm trying to troubleshoot why my API returns a 503 …

heroku heroku-api heroku-cli

3
推荐指数
3
解决办法
2094
查看次数

建立一个电子项目需要多长时间?

我有一个小项目,几乎没有 npm 依赖项,并且需要 30 多分钟(并且还在增加)来构建。我不知道这是正常的还是有什么问题导致构建延迟。

我有两个问题:

  1. 需要这么长时间正常吗?
  2. 建设一个项目平均需要多长时间?

我的package.json:

{
  "name": "...",
  "version": "0.0.1",
  "author": "Ricardo Villagrana <...@gmail.com>",
  "description": "...",
  "license": null,
  "main": "./dist/electron/main.js",
  "scripts": {
    "build": "node .electron-vue/build.js && electron-builder",
    "build:dir": "node .electron-vue/build.js && electron-builder --dir",
    "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
    "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
    "dev": "node .electron-vue/dev-runner.js",
    "e2e": "npm run pack && mocha test/e2e",
    "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
    "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
    "pack": "npm run pack:main && npm …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js electron electron-builder

0
推荐指数
1
解决办法
2733
查看次数